login
A280408
Irregular triangle read by rows listing the prime numbers that appear from the trajectory of n in Collatz Problem.
3
2, 2, 3, 5, 2, 2, 5, 2, 3, 5, 2, 7, 11, 17, 13, 5, 2, 2, 7, 11, 17, 13, 5, 2, 5, 2, 11, 17, 13, 5, 2, 3, 5, 2, 13, 5, 2, 7, 11, 17, 13, 5, 2, 23, 53, 5, 2, 2, 17, 13, 5, 2, 7, 11, 17, 13, 5, 2, 19, 29, 11, 17, 13, 5, 2, 5, 2, 2, 11, 17, 13, 5, 2, 23, 53, 5, 2, 3, 5, 2, 19, 29, 11, 17, 13, 5, 2
OFFSET
1,1
EXAMPLE
The irregular array a(n,k) starts:
n\k 1 2 3 4 5 6
...
1: 2
2: 2
3: 3 5 2
4: 2
5: 5 2
6: 3 5 2
7: 7 11 17 13 5 2
8: 2
9: 7 11 17 13 5 2
10: 5 2
11: 11 17 13 5 2
12: 3 5 2
13: 13 5 2
14: 7 11 17 13 5 2
15: 23 53 5 2
MATHEMATICA
Table[Select[NestWhileList[If[EvenQ@ #, #/2, 3 # + 1] &, n, # > 1 &], PrimeQ], {n, 2, 30}] // Flatten (* Michael De Vlieger, Jan 02 2017 *)
PROG
(Python)
from sympy import isprime
def a(n):
if n==1: return [2]
l=[n, ]
while True:
if n%2==0: n/=2
else: n = 3*n + 1
l+=[n, ]
if n<2: break
return list(filter(lambda i: isprime(i), l))
for n in range(1, 21): print a(n) # Indranil Ghosh, Apr 14 2017
CROSSREFS
Sequence in context: A329792 A058256 A140183 * A130725 A256015 A138117
KEYWORD
tabf,nonn
AUTHOR
Matthew Campbell, Jan 02 2017
STATUS
approved