OFFSET
2,1
COMMENTS
The n-th row of the triangle provides the 3p+1 sequence for n, such that the sequence terminates at the first occurrence of 2. The 3p+1 sequence is a variation of the 3x+1 (Collatz) sequence.
The 3p+1 sequence for n >= 2 is defined as follows: b(0) = n; b(n+1) = 3 * b(n) + 1 if b(n) is prime; otherwise, b(n+1) = b(n) divided by the smallest prime factor of b(n).
It seems that all 3p+1 sequences reach 2. This has been verified for n up to 5*10^8. Once a 3p+1 sequence reaches 2, it repeats the following cycle: 2, 7, 22, 11, 34, 17, 52, 26, 13, 40, 20, 10, 5, 16, 8, 4, 2, ...
LINKS
Jack Brennen, Felice Russo, A Collatz-like sequence.
EXAMPLE
The irregular array a(n,k) starts:
n\k 0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17
2: 2
3: 3 10 5 16 8 4 2
4: 4 2
5: 5 16 8 4 2
6: 6 3 10 5 16 8 4 2
7: 7 22 11 34 17 52 26 13 40 20 10 5 16 8 4 2
8: 8 4 2
9: 9 3 10 5 16 8 4 2
10: 5 16 8 4 2
11: 11 34 17 52 26 13 40 20 10 5 16 8 4 2
PROG
(PARI) row(n) = {print1 (n, ", "); while (n!=2, nn = if (isprime(n), 3*n+1, n/factor(n)[1, 1]); print1(nn, ", "); n=nn); } \\ Michel Marcus, Jan 02 2016
(Python)
from sympy import isprime, primefactors
def a(n):
if n==2: return [2]
l=[n, ]
while True:
if isprime(n): n = 3*n + 1
else: n/=min(primefactors(n))
l+=[n, ]
if n==2: break
return l
for n in range(2, 21): print a(n) # Indranil Ghosh, Apr 22 2017
CROSSREFS
KEYWORD
nonn,tabf
AUTHOR
Robert C. Lyons, Dec 31 2015
STATUS
approved