login
A258822
Number of times that k iterations of n under the '3x+1' map yield k for some k.
3
0, 1, 0, 0, 0, 0, 1, 1, 0, 1, 0, 0, 0, 0, 0, 0, 0, 1, 1, 0, 0, 0, 0, 2, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 1, 1, 1, 1, 0, 1, 0, 0, 0, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 0, 0, 0, 0, 1, 0, 1, 0, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 1, 0, 0, 0, 0, 0
OFFSET
1,24
COMMENTS
This sequence uses the definition in A006370: if n is odd, n -> 3*n+1, if n is even, n -> n/2.
The number 3 appears first at a(63105). Do all nonnegative numbers appear? See A258824.
EXAMPLE
For n = 6, the '3x+1' map is as follows: 6 -> 3 -> 10 -> 5 -> 16 -> 8 -> 4 -> 2 -> 1. Here the number of iterations is 8. However, after the k-th iteration, the result does not equal k. Thus a(6) = 0.
For n = 7, the '3x+1' map is as follows: 7 -> 22 -> 11 -> 34 -> 17 -> 52 -> 26 -> 13 -> 40 -> 20 -> 10 -> 5 -> 16 -> 8 -> 4 -> 2 -> 1. Only after 10 iterations do we arrive at 10. Since this is the only time this happens, a(7) = 1.
MATHEMATICA
A258822[n_]:=Count[MapIndexed[{#1}==#2-1&, NestWhileList[If[OddQ[#], 3#+1, #/2]&, n, #>1&]], True]; Array[A258822, 100] (* Paolo Xausa, Nov 06 2023 *)
PROG
(PARI) Tvect(n)=v=[n]; while(n!=1, if(n%2, k=(3*n+1); v=concat(v, k); n=k); if(!(n%2), k=n/2; v=concat(v, k); n=k)); v
for(n=1, 200, d=Tvect(n); c=0; for(i=1, #d, if(d[i]==i-1, c++)); print1(c, ", "))
CROSSREFS
KEYWORD
nonn
AUTHOR
Derek Orr, Jun 11 2015
STATUS
approved