[go: up one dir, main page]

login

Year-end appeal: Please make a donation to the OEIS Foundation to support ongoing development and maintenance of the OEIS. We are now in our 61st year, we have over 378,000 sequences, and we’ve reached 11,000 citations (which often say “discovered thanks to the OEIS”).

A265416
Number of steps needed to reach 1 or to enter the cycle in the "sqrt(Pi)*x+1" problem.
1
0, 1, 1, 2, 6, 1, 5, 3, 5, 7, 9, 2, 4, 6, 6, 4, 59, 6, 61, 8, 63, 10, 14, 3, 12, 5, 5, 7, 7, 7, 58, 5, 10, 60, 11, 7, 10, 62, 13, 9, 13, 64, 42, 11, 11, 15, 66, 4, 55, 13, 13, 6, 68, 6, 57, 8, 15, 8, 10, 8, 48, 59, 10, 6, 10, 10, 14, 61, 72, 12, 12, 8, 12, 10
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
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
Sequence in context: A220959 A360598 A243434 * A199953 A364682 A076039
KEYWORD
nonn
AUTHOR
Michel Lagneau, Dec 08 2015
STATUS
approved