OFFSET
3,1
COMMENTS
LINKS
Colin Barker, Table of n, a(n) for n = 3..1000
Index entries for linear recurrences with constant coefficients, signature (2).
FORMULA
For n >= 5, a(n) = 5*2^n/32. - David A. Corneth, Jun 01 2017
From Colin Barker, Jun 01 2017: (Start)
G.f.: x^3*(159 - 312*x - 7*x^2) / (1 - 2*x).
a(n) = 2*a(n-1) for n>5.
(End)
MAPLE
nn:=10^12:
for n from 3 to 35 do:
ii:=0:
for k from 2 to 10^6 while(ii=0) do:
m:=k:s1:=0:s2:=0:
for i from 1 to nn while(m<>1) do:
if irem(m, 2)=0
then
s2:=s2+1:m:=m/2:
else
s1:=s1+1:m:=3*m+1:
fi:
od:
if n*s1=s1+s2
then
ii:=1: printf(`%d, `, k):
else
fi:
od:od:
MATHEMATICA
f[u_]:=Module[{a=u, k=0}, While[a!=1, k++; If[EvenQ[a], a=a/2, a=a*3+1]]; k]; Table[f[u], {u, 10^7}]; g[v_]:=Count[Differences[NestWhileList[If[EvenQ[#], #/2, 3#+1]&, v, #>1&]], _?Positive]; Table[g[v], {v, 10^7}]; Do[k=3; While[g[k]/f[k]!=1/n, k++]; Print[n, " ", k], {n, 3, 35}]
PROG
(PARI) a(n) = if(n < 5, [0, 0, 159, 6][n], 5<<(n-5)) \\ David A. Corneth, Jun 01 2017
(PARI) Vec(x^3*(159 - 312*x - 7*x^2) / (1 - 2*x) + O(x^50)) \\ Colin Barker, Jun 01 2017
CROSSREFS
KEYWORD
nonn,easy
AUTHOR
Michel Lagneau, Jun 01 2017
STATUS
approved