A280408 Irregular triangle read by rows listing the prime numbers that appear from the trajectory of n in Collatz Problem.
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
Examples
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
Links
- David Radcliffe, Table of n, a(n) for n = 1..10000
Programs
-
Mathematica
Table[Select[NestWhileList[If[EvenQ@ #, #/2, 3 # + 1] &, n, # > 1 &], PrimeQ], {n, 2, 30}] // Flatten (* Michael De Vlieger, Jan 02 2017 *)
-
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