login
The OEIS is supported by the many generous donors to the OEIS Foundation.

 

Logo
Hints
(Greetings from The On-Line Encyclopedia of Integer Sequences!)
A258098 3x + 1 sequence starting at 79. 3
79, 238, 119, 358, 179, 538, 269, 808, 404, 202, 101, 304, 152, 76, 38, 19, 58, 29, 88, 44, 22, 11, 34, 17, 52, 26, 13, 40, 20, 10, 5, 16, 8, 4, 2, 1, 4, 2, 1, 4, 2, 1, 4, 2, 1, 4, 2, 1, 4, 2, 1, 4, 2, 1, 4, 2, 1, 4, 2, 1, 4, 2, 1, 4, 2, 1, 4, 2, 1, 4, 2, 1, 4, 2, 1, 4, 2, 1, 4, 2, 1, 4 (list; graph; refs; listen; history; text; internal format)
OFFSET
0,1
LINKS
FORMULA
a(0) = 79; a(n) = 3*a(n - 1) + 1 if a(n - 1) is odd, a(n) = a(n - 1)/2 otherwise.
EXAMPLE
79 is odd, so it's followed by 3 * 79 + 1 = 238.
238 is even, so it's followed by 238/2 = 119.
MATHEMATICA
NestList[If[EvenQ[#], #/2, 3# + 1] &, 79, 100]
PROG
(Scheme, with memoization-macro definec)
(definec (A258098 n) (if (zero? n) 79 (A006370 (A258098 (- n 1)))))
(define (A006370 n) (if (even? n) (/ n 2) (+ 1 n n n))) ;; Image of n under the `3x+1' map.
;; Antti Karttunen, May 26 2015
(Magma) [n eq 1 select 79 else IsOdd(Self(n-1)) select 3*Self(n-1)+1 else Self(n-1) div 2: n in [1..100]]; // Vincenzo Librandi, May 27 2015
(Scala) def collatz(n: Int): Int = n % 2 match {
case 0 => n / 2
case _ => 3 * n + 1
}
def collatzSeq(n: Int): LazyList[Int] = LazyList.iterate(n)(collatz)
collatzSeq(79).take(100).toList // Alonso del Arte, Apr 26 2020
CROSSREFS
Row 79 of A347270.
Sequence in context: A278837 A260335 A257933 * A141964 A347032 A142285
KEYWORD
nonn,easy
AUTHOR
Alonso del Arte, May 19 2015
STATUS
approved

Lookup | Welcome | Wiki | Register | Music | Plot 2 | Demos | Index | Browse | More | WebCam
Contribute new seq. or comment | Format | Style Sheet | Transforms | Superseeker | Recents
The OEIS Community | Maintained by The OEIS Foundation Inc.

License Agreements, Terms of Use, Privacy Policy. .

Last modified March 28 22:04 EDT 2024. Contains 371254 sequences. (Running on oeis4.)