login
The OEIS is supported by the many generous donors to the OEIS Foundation.

 

Logo
Hints
(Greetings from The On-Line Encyclopedia of Integer Sequences!)
A280408 Irregular triangle read by rows listing the prime numbers that appear from the trajectory of n in Collatz Problem. 3

%I #22 Dec 07 2019 12:18:28

%S 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,

%T 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,

%U 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

%N Irregular triangle read by rows listing the prime numbers that appear from the trajectory of n in Collatz Problem.

%e The irregular array a(n,k) starts:

%e n\k 1 2 3 4 5 6

%e ...

%e 1: 2

%e 2: 2

%e 3: 3 5 2

%e 4: 2

%e 5: 5 2

%e 6: 3 5 2

%e 7: 7 11 17 13 5 2

%e 8: 2

%e 9: 7 11 17 13 5 2

%e 10: 5 2

%e 11: 11 17 13 5 2

%e 12: 3 5 2

%e 13: 13 5 2

%e 14: 7 11 17 13 5 2

%e 15: 23 53 5 2

%t Table[Select[NestWhileList[If[EvenQ@ #, #/2, 3 # + 1] &, n, # > 1 &], PrimeQ], {n, 2, 30}] // Flatten (* _Michael De Vlieger_, Jan 02 2017 *)

%o (Python)

%o from sympy import isprime

%o def a(n):

%o if n==1: return [2]

%o l=[n, ]

%o while True:

%o if n%2==0: n/=2

%o else: n = 3*n + 1

%o l+=[n, ]

%o if n<2: break

%o return list(filter(lambda i: isprime(i), l))

%o for n in range(1, 21): print a(n) # _Indranil Ghosh_, Apr 14 2017

%Y Cf. A070165, A280409.

%K tabf,nonn

%O 1,1

%A _Matthew Campbell_, Jan 02 2017

Lookup | Welcome | Wiki | Register | Music | Plot 2 | Demos | Index | Browse | More | WebCam
Contribute new seq. or comment | Format | Style Sheet | Transforms | Superseeker | Recents
The OEIS Community | Maintained by The OEIS Foundation Inc.

License Agreements, Terms of Use, Privacy Policy. .

Last modified March 28 20:05 EDT 2024. Contains 371254 sequences. (Running on oeis4.)