OFFSET
1,1
EXAMPLE
The trajectory of 21 under the "3x+1" map is : 21 ->64 ->32 ->16 ->8 ->4 ->2 ->1 So 7 steps are needing to reach 1 and 7 divides 21, hence 21 is in the sequence. For 261, 29 steps are needing and 261/29=9 hence 261 is also in the sequence.
MATHEMATICA
nsdnQ[n_]:=Divisible[n, Length[NestWhileList[If[EvenQ[#], #/2, 3#+1]&, n, #>1&]]-1]; Select[Range[2, 1800], nsdnQ] (* Harvey P. Dale, Mar 24 2018 *)
PROG
(PARI) for(n=2, 3000, s=n; t=0; while(s!=1, t++; if(s%2==0, s=s/2, s=3*s+1); if(s==1+n*frac(n/t), print1(n, ", "); ); ))
CROSSREFS
KEYWORD
easy,nonn
AUTHOR
Benoit Cloitre, May 20 2002
STATUS
approved