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.

A270814 a(1)=0; thereafter a(2k)=k+a(k), a(2k+1)=6k+4+a(6k+4).

This page as a plain text file.
%I A270814 #51 Dec 11 2022 01:24:29
%S A270814 0,1,46,3,31,49,281,7,330,36,248,55,106,288,679,15,197,339,500,46,127,
%T A270814 259,610,67,633,119,101413,302,413,694,101073,31,808,214,505,357,498,
%U A270814 519,2305,66,101290,148,1295,281,452,633,100932,91,757,658,1079,145,346,101440,102261,330,1596,442,2128
%N A270814 a(1)=0; thereafter a(2k)=k+a(k), a(2k+1)=6k+4+a(6k+4).
%C A270814 Inspired by A266569.
%C A270814 In other words, a(n) = n/2 + a(n/2) if n even, a(n) = 3n+1+a(3n+1) if n odd.
%C A270814 From _Seiichi Manyama_, Apr 25 2016: (Start)
%C A270814 This sequence was inspired by the Collatz problem (A006577).
%C A270814 The Collatz rule is as follows: If n is even, divide it by 2, otherwise multiply it by 3 and add 1 (A006370).
%C A270814 For example, starting with n = 3, one gets the sequence 3, 10, 5, 16, 8, 4, 2, 1. So a(3) = 10 + 5 + 16 + 8 + 4 + 2 + 1 = 46. (End) [Comment edited by _N. J. A. Sloane_, Apr 25 2016]
%H A270814 Seiichi Manyama, <a href="/A270814/b270814.txt">Table of n, a(n) for n = 1..20000</a>
%H A270814 Seiichi Manyama, <a href="/A270814/a270814.txt">Table of n, a(n) for n = 1..650289</a>
%H A270814 <a href="/index/3#3x1">Index entries for sequences related to 3x+1 (or Collatz) problem</a>
%p A270814 A270814 := proc(n)
%p A270814         local a, traj ;
%p A270814         a := 0 ;
%p A270814         traj := n ;
%p A270814         while traj > 1 do
%p A270814                 if type(traj, 'even') then
%p A270814                         traj := traj/2 ;
%p A270814                 else
%p A270814                         traj := 3*traj+1 ;
%p A270814                 end if;
%p A270814                 a := a+traj ;
%p A270814         end do:
%p A270814         return a;
%p A270814 end proc:
%p A270814 [seq(A270814(n),n=1..60)];
%o A270814 (PARI) a(n) = my(ret=n-1); while((n>>=valuation(n,2)) > 1, ret+=5*n+2; n=3*n+1); ret; \\ _Kevin Ryde_, Dec 10 2022
%Y A270814 Cf. A006370 (Collatz step), A006577 (trajectory length), A033493 (sum including n).
%Y A270814 Cf. A266569, A271473.
%K A270814 nonn
%O A270814 1,3
%A A270814 _N. J. A. Sloane_, Apr 08 2016
%E A270814 Typo in definition corrected by _Gionata Neri_, Apr 08 2016