cp's OEIS Frontend

This is a front-end for the Online Encyclopedia of Integer Sequences, made by Christian Perfect. The idea is to provide OEIS entries in non-ancient HTML, and then to think about how they're presented visually. The source code is on GitHub.

A258098 3x + 1 sequence starting at 79.

This page as a plain text file.
%I A258098 #22 Sep 08 2022 08:46:12
%S A258098 79,238,119,358,179,538,269,808,404,202,101,304,152,76,38,19,58,29,88,
%T A258098 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,
%U A258098 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
%N A258098 3x + 1 sequence starting at 79.
%F A258098 a(0) = 79; a(n) = 3*a(n - 1) + 1 if a(n - 1) is odd, a(n) = a(n - 1)/2 otherwise.
%e A258098 79 is odd, so it's followed by 3 * 79 + 1 = 238.
%e A258098 238 is even, so it's followed by 238/2 = 119.
%t A258098 NestList[If[EvenQ[#], #/2, 3# + 1] &, 79, 100]
%o A258098 (Scheme, with memoization-macro definec)
%o A258098 (definec (A258098 n) (if (zero? n) 79 (A006370 (A258098 (- n 1)))))
%o A258098 (define (A006370 n) (if (even? n) (/ n 2) (+ 1 n n n))) ;; Image of n under the `3x+1' map.
%o A258098 ;; _Antti Karttunen_, May 26 2015
%o A258098 (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
%o A258098 (Scala) def collatz(n: Int): Int = n % 2 match {
%o A258098   case 0 => n / 2
%o A258098   case _ => 3 * n + 1
%o A258098 }
%o A258098 def collatzSeq(n: Int): LazyList[Int] = LazyList.iterate(n)(collatz)
%o A258098 collatzSeq(79).take(100).toList // _Alonso del Arte_, Apr 26 2020
%Y A258098 Cf. A006370, A033478, A008874, A258056.
%Y A258098 Row 79 of A347270.
%K A258098 nonn,easy
%O A258098 0,1
%A A258098 _Alonso del Arte_, May 19 2015