%I #36 Apr 16 2021 16:07:26
%S 0,1,4,2,7,5,5,3,10,8,8,6,8,6,6,4,13,11,11,9,11,9,9,7,11,9,9,7,9,7,7,
%T 5,16,14,14,12,14,12,12,10,14,12,12,10,12,10,10,8,14,12,12,10,12,10,
%U 10,8,12,10,10,8,10,8,8,6,19,17,17,15,17,15,15,13,17,15,15,13,15,13
%N Number of steps for the trajectory of n under the map k -> A271478(k) to reach 1.
%C Arises in studying A266569.
%C Records are 0, 1, 4, 7, 10, 13, 16, 19, 22, 25, 28, 31, 34, 37, 40, ... and occur at positions 1, 2, 3, 5, 9, 17, 33, 65, 129, 257, 513, 1025, 2049, 4097, 8193, ...
%H N. J. A. Sloane, <a href="/A271479/b271479.txt">Table of n, a(n) for n = 1..10000</a>
%H Christian Krause, <a href="https://github.com/ckrause/loda/blob/master/programs/oeis/271/A271479.asm">LODA program for A271479</a>
%F a(1) = 0; a(2*n) = a(n)+1; a(2*n+1) = a(n+1)+3. - _Christian Krause_, Mar 19 2021
%F a(n) = A000120(n-1) + 3*A023416(n-1), for n>=2. - _Kevin Ryde_, Mar 21 2021
%p f:=n->if n mod 2 = 0 then n/2 else 2*n+2; fi; # A271478
%p a:=[]; B:=1000;
%p for n from 1 to 100 do
%p ct:=0; s:=n;
%p for k from 1 to B while s>1 do
%p s:=f(s); ct:=ct+1; od:
%p if ct=B then lprint("error, need to increase limit B"); break; fi;
%p a:=[op(a),ct]; od:
%p a;
%t Table[Length[NestWhileList[If[EvenQ[#],#/2,2#+2]&,n,#!=1&]]-1,{n,80}] (* _Harvey P. Dale_, May 02 2017 *)
%o (PARI) a(n) = if(n--, 3*(logint(n,2)+1) - 2*hammingweight(n), 0); \\ _Kevin Ryde_, Mar 21 2021
%Y Cf. A266569, A271478, A000120, A023416.
%K nonn
%O 1,3
%A _N. J. A. Sloane_, Apr 10 2016
|