OFFSET
1,1
COMMENTS
Define a Collatz cycle C(prime(n)) = {c(z+1) = c(z)/2 if c(z) mod 2 = 0, otherwise c(z+1) = 3*c(z) + 1}, z >= 1, c(1) = prime(n), n >= 1}; then the length of C(prime(n)) depends only on the starting point c(1) if C ends with c(z) = 1. The length of C(prime(n)) is z, so a(n) = z.
The longest C(prime(n)) out of 10^5 prime numbers is C(prime(96648)) = C(1252663) with a(96648) = 510.
Until now C is not proved mathematically. So if the ending point c(z) is not equal to 1 then C(prime(n)) is not a 'true' Collatz cycle or does not exist.
LINKS
Freimut Marschner, Table of n, a(n) for n = 1..100000
FORMULA
EXAMPLE
a(1) = {c(1) = prime(1) = 2, 2 mod 2 = 0, c(2) = 2/2 = 1, z=2} = 2;
a(3) = {c(1) = prime(3) = 5, 5 mod 2 = 1, c(2) = 3*5 + 1 = 16; 16 mod 2 = 0, c(3) = 16/2 = 8; 8 mod 2 = 0, c(4) = 8/2 = 4; 4 mod 2 = 0, c(5) = 4/2 = 2; 2 mod 2 = 0, c(6) = 2/2 = 1, z=6} = 6.
PROG
(PARI) a(n)=n=prime(n); A=List; while(n != 1, listput(A, n); if(n%2==0, n=n/2, n=3*n+1)); listput(A, 1); return(#Vec(A)) \\ Edward Jiang, Sep 06 2014
CROSSREFS
KEYWORD
nonn
AUTHOR
Freimut Marschner, Aug 12 2014
STATUS
approved