OFFSET
1,2
COMMENTS
For k < 5*10^6, the fourteen distinct pairs of squares in the order of appearance are: (1, 0), (1, 1), (1, 4), (4, 9), (36, 64), (1, 9), (25, 49), (4, 16), (16, 36), (9, 25), (1, 16), (81, 144), (4, 25) and (64, 121).
The numbers 2^(m^2) = A002416(m) are in the sequence, and the corresponding pairs of squares are (1, m^2).
Number of terms <= 10^h: 2, 4, 7, 202, 203, 474, 20888, etc. Robert G. Wilson v, Feb 14 2017
LINKS
EXAMPLE
17 is in the sequence because the Collatz trajectory is 17 -> 52 -> 26 -> 13 -> 40 -> 20 -> 10 -> 5 -> 16 -> 8 -> 4 -> 2 -> 1 => the number of odd members is 4 = 2^2 and number of even members is 9 = 3^2.
MAPLE
nn:=10^6:
for n from 1 to 10000 do:
m:=n:i1:=1:i2:=0:
for i from 1 to nn while(m<>1) do:
if irem(m, 2)=0
then
m:=m/2:i2:=i2+1:
else
m:=3*m+1:i1:=i1+1:
fi:
od:
if sqrt(i1)=floor(sqrt(i1)) and sqrt(i2)=floor(sqrt(i2))
then
printf(`%d, `, n):
else
fi:
od:
MATHEMATICA
fQ[n_] := Block[{m = n, e = 0, o = 1}, While[m > 1, If[OddQ@ m, m = 3 m + 1; o++, m /= 2; e++]]; IntegerQ@ Sqrt@ e && IntegerQ@ Sqrt@ o]; Select[ Range@ 3855, fQ] (* Robert G. Wilson v, Feb 14 2017 *)
memsqQ[n_]:=Module[{col=NestWhileList[If[EvenQ[#], #/2, 3#+1]&, n, #!=1&]}, AllTrue[ {Sqrt[ Count[ col, _?(EvenQ[#]&)]], Sqrt[Count[col, _?(OddQ[ #]&)]]}, IntegerQ]]; Select[Range[4000], memsqQ] (* The program uses the AllTrue function from Mathematica version 10 *) (* Harvey P. Dale, Sep 04 2018 *)
CROSSREFS
KEYWORD
nonn
AUTHOR
Michel Lagneau, Feb 14 2017
STATUS
approved