OFFSET
1,4
COMMENTS
The sqrt(Pi)*x+1 problem is as follows: start with a number x. If x is even, divide it by 2, otherwise multiply it by sqrt(Pi) and add 1, and then take the integer part.
There are three possible behaviors for such trajectories when n>0:
(i) The trajectory reaches 1 (and enters the "trivial" cycle 2-1-2-1-2...).
(ii) Cyclic trajectory. The trajectory becomes periodic and the period does not contain a 1.
(iii) The trajectory is divergent (I conjecture that this cannot occur).
For many numbers, the element of the trivial cycle is 1, except for the numbers: 3, 6, 7, 12, 13, 14, 15, 23, 24, 26, 27, 28, 29, 30, 33, 35, 37, 39, 41, 46, 48, 52, 54, 56, 58, 59, 60, 63, ...
LINKS
Michel Lagneau, Table of n, a(n) for n = 1..10000
EXAMPLE
a(5) = 6 because 5 -> 9 -> 16 -> 8 -> 4 -> 2 -> 1 with 6 iterations where:
5 -> floor(5*sqrt(Pi)+1) = 9;
9 -> floor(9*sqrt(Pi)+1) = 16;
16 -> 16/2 = 8 -> 8/2 = 4 -> 4/2 = 2 -> 2/2 = 1, the end of the cycle.
a(6) = 1 because 6 -> 3 with 1 iteration where:
6 -> 3;
3 -> floor(3*sqrt(Pi)+1) = 6, the end of the cycle.
MAPLE
A265416:= proc(n)
local cyc, x;
x := n;
cyc := {x} ;
for s from 0 do
if {1} intersect cyc = {1} then
return s;
end if;
if type(x, 'even') then
x := x/2 ;
else
x := floor(evalf(sqrt(Pi))*x+1) ;
end if;
if {x} intersect cyc = {x} and s > 0 then
return s;
end if;
cyc := cyc union {x} ;
end do:
end proc: # Program from R.J. Mathar adapted for this sequence - see A264789.
MATHEMATICA
Table[Length@ NestWhileList[If[EvenQ@ #, #/2, Floor[# Sqrt@ Pi + 1]] &, n, UnsameQ, All] - 2, {n, 0, 72}] (* Program from Michael De Vlieger adapted for this sequence - see A264789 *).
CROSSREFS
KEYWORD
nonn
AUTHOR
Michel Lagneau, Dec 08 2015
STATUS
approved