|
|
A297307
|
|
Given n, define the sequence x(1) = n, thereafter if x(i) is even set x(i+1) = x(i)/2, if x(i) is odd and divisible by 3, 5 or 7 set x(i+1) = 5*x(i) + 1, otherwise set x(i+1) = 3*x(i) + 1. Then a(n) is the smallest i>1 such that x(i) = 1, 5, or 553, or -1 if none of those numbers is ever reached.
|
|
3
|
|
|
4, 2, 6, 3, 7, 7, 22, 4, 19, 2, 10, 8, 5, 23, 19, 5, 8, 20, 16, 3, 9, 11, 17, 9, 39, 6, 12, 24, 14, 20, 78, 6, 36, 9, 15, 21, 27, 17, 34, 4, 81, 10, 39, 12, 55, 18, 76, 10, 31, 40, 10, 7, 7, 13, 46, 25, 32, 15, 28, 21, 21, 79, 37, 7, 37, 37, 23, 10, 43, 16, 74, 22
(list;
graph;
refs;
listen;
history;
text;
internal format)
|
|
|
OFFSET
|
1,1
|
|
COMMENTS
|
This is the Syracuse sequence modified by adding a constraint.
if x is odd and divisible by 3 or 5 or 7 then x = 5*x + 1 instead of x = 3x + 1, and x = 3*x + 1 if not divisible by 3 or 5 or 7.
The sequence if x even then x = x/2 and if x odd then x = 5*x + 1 diverge for n even > 12 or n odd > 5.
More than 1/3 of the odd numbers are divisible by 3 or 5 or 7 so this sequence will diverge or if not the Syracuse sequence will converge, it is easy to find that with the constraint added this sequence converges but with different cycles which are function of the n starting point.
There are 3 different cycles to end this sequence with the repetition of the cycle.
The main one is with a cycle of 6 values 5, 26, 13, 40, 20, 10 for 3/4 of the n values.
The second one is the same as the Syracuse sequence 1,4,2 for 21/100 of the n values.
And a third with a cycle of 175 values starting 553, 2766, 1383, 6916 ... for 3.3/100 of the n values.
|
|
LINKS
|
|
|
EXAMPLE
|
n = 1, x(1) = 1 , x(2)= 4, x(3) = 2, x(4) = 1 so a(1) = 4.
|
|
MATHEMATICA
|
With[{a = {3, 5, 7}, b = {1, 5, 553}, nn = 10^3}, Array[Length@ NestWhileList[Function[n, Which[EvenQ@ n, n/2, And[OddQ@ n, AnyTrue[a, Divisible[n, #] &]], 5 n + 1, True, 3 n + 1]], #, FreeQ[b, #] &, {2, 1}, nn] /. k_ /; k == nn + 1 -> -1 &, 72]] (* Michael De Vlieger, Dec 31 2017 *)
|
|
PROG
|
(BASIC)
For n=1 to 5000
i=1:x=n
10 i=i+1
If x-2*Int(x/2)=0 Then x=x/2:Goto 20
If x-3*Int(x/3)=0 or x-5*Int(x/5)=0 Then x=5*x+1:Goto 20
x=3*x+1
20 if x=1 or x=5 or x=553 Then Print n; i:Goto 30
Goto 10
30 Next n
End
|
|
CROSSREFS
|
|
|
KEYWORD
|
nonn
|
|
AUTHOR
|
|
|
STATUS
|
approved
|
|
|
|