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.

A384468 a(0) = 1; for n >= 1, a(n) = a(n-1)/2 if a(n-1) is even, otherwise a(n) = 2*a(n-1) + n.

This page as a plain text file.
%I A384468 #30 Jun 19 2025 00:25:45
%S A384468 1,3,8,4,2,1,8,4,2,1,12,6,3,19,52,26,13,43,104,52,26,13,48,24,12,6,3,
%T A384468 33,94,47,124,62,31,95,224,112,56,28,14,7,54,27,96,48,24,12,6,3,54,27,
%U A384468 104,52,26,13,80,40,20,10,5,69,198,99,260,130,65,195,456,228,114,57,184
%N A384468 a(0) = 1; for n >= 1, a(n) = a(n-1)/2 if a(n-1) is even, otherwise a(n) = 2*a(n-1) + n.
%C A384468 The sequence behaves similarly to the Collatz sequence but introduces a linearly increasing term n when updating odd values.
%C A384468 a(n) = 1 for n = 0, 5, 9, 60843, 19628571, and 772944372 and no other values up to 10^14. - _David Radcliffe_, Jun 18 2025
%F A384468 a(0) = 1.
%F A384468 For n >= 1:
%F A384468 a(n) = a(n-1)/2 if a(n-1) is even;
%F A384468 a(n) = 2*a(n-1) + n if a(n-1) is odd.
%e A384468 a(2) = 2*3 + 2 = 8 (since a(1) is odd).
%e A384468 a(3) = 8/2 = 4 (since a(2) is even).
%t A384468 a[0] = 1; a[n_] := a[n] = If[EvenQ[a[n-1]], a[n-1]/2, 2*a[n-1] + n]; Array[a, 100, 0] (* _Amiram Eldar_, May 30 2025 *)
%o A384468 (Python)
%o A384468 def generate_sequence(n_terms):
%o A384468     seq = [1]  # a(0) = 1
%o A384468     for n in range(1, n_terms):
%o A384468         prev = seq[-1]
%o A384468         if prev % 2 == 0:
%o A384468             seq.append(prev // 2)
%o A384468         else:
%o A384468             seq.append(2 * prev + n)
%o A384468     return seq
%o A384468 seq = generate_sequence(1000)
%o A384468 print(seq)
%Y A384468 Cf. A000079, A006370.
%K A384468 nonn,easy
%O A384468 0,2
%A A384468 _Simon R Blow_, May 30 2025