|
|
A275663
|
|
Number of squares in {n, f(n), f(f(n)), ...., 1}, where f is the Collatz function.
|
|
1
|
|
|
1, 1, 3, 2, 3, 3, 3, 2, 4, 3, 3, 3, 3, 3, 3, 3, 3, 4, 3, 3, 4, 3, 3, 3, 4, 3, 5, 3, 3, 3, 5, 3, 5, 3, 3, 5, 3, 3, 3, 3, 5, 4, 5, 3, 3, 3, 5, 3, 4, 4, 3, 3, 3, 5, 5, 3, 5, 3, 3, 3, 3, 5, 3, 4, 5, 5, 3, 3, 3, 3, 5, 5, 5, 3, 5, 3, 3, 3, 3, 3, 4, 5, 5, 4, 5, 5, 3
(list;
graph;
refs;
listen;
history;
text;
internal format)
|
|
|
OFFSET
|
1,3
|
|
COMMENTS
|
Or number of squares in the trajectory of n under the 3x+1 map (i.e. the number of squares until the trajectory reaches 1).
|
|
LINKS
|
|
|
EXAMPLE
|
The finite sequence n, f(n), f(f(n)), ...., 1 for n = 12 is: 12, 6, 3, 10, 5, 16, 8, 4, 2, 1, which has three square terms. Hence a(12) = 3.
|
|
MATHEMATICA
|
Reap[For[n=1, n <= 100, n++, s=n; t=1; While[s != 1, If[IntegerQ[Sqrt[s]], t++]; If[EvenQ[s], s=s/2, s=3*s+1]]; If[s == 1, Sow[t]]]][[2, 1]] (* Jean-François Alcover, Nov 17 2016, adapted from PARI *)
|
|
PROG
|
(PARI) print1(1, ", "); for(n=2, 100, s=n; t=1; while(s!=1, if(issquare(s), t++, t=t); if(s%2==0, s=s/2, s=(3*s+1)); if(s==1, print1(t, ", "); ); ))
|
|
CROSSREFS
|
|
|
KEYWORD
|
nonn
|
|
AUTHOR
|
|
|
STATUS
|
approved
|
|
|
|