cp's OEIS Frontend

This is a front-end for the Online Encyclopedia of Integer Sequences, made by Christian Perfect. The idea is to provide OEIS entries in non-ancient HTML, and then to think about how they're presented visually. The source code is on GitHub.

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

This page as a plain text file.
%I A280408 #28 Jun 07 2025 11:56:52
%S A280408 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 A280408 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 A280408 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 A280408 Irregular triangle read by rows listing the prime numbers that appear from the trajectory of n in Collatz Problem.
%H A280408 David Radcliffe, <a href="/A280408/b280408.txt">Table of n, a(n) for n = 1..10000</a>
%e A280408 The irregular array a(n,k) starts:
%e A280408 n\k   1   2   3   4   5   6
%e A280408 ...
%e A280408 1:    2
%e A280408 2:    2
%e A280408 3:    3   5   2
%e A280408 4:    2
%e A280408 5:    5   2
%e A280408 6:    3   5   2
%e A280408 7:    7  11  17  13   5   2
%e A280408 8:    2
%e A280408 9:    7  11  17  13   5   2
%e A280408 10:   5  2
%e A280408 11:  11  17  13   5   2
%e A280408 12:   3   5   2
%e A280408 13:  13   5   2
%e A280408 14:   7  11  17  13   5   2
%e A280408 15:  23  53   5   2
%t A280408 Table[Select[NestWhileList[If[EvenQ@ #, #/2, 3 # + 1] &, n, # > 1 &], PrimeQ], {n, 2, 30}] // Flatten (* _Michael De Vlieger_, Jan 02 2017 *)
%o A280408 (Python)
%o A280408 from sympy import isprime
%o A280408 def a(n):
%o A280408     if n==1: return [2]
%o A280408     l=[n, ]
%o A280408     while True:
%o A280408         if n%2==0: n//=2
%o A280408         else: n = 3*n + 1
%o A280408         l+=[n, ]
%o A280408         if n<2: break
%o A280408     return list(filter(lambda i: isprime(i), l))
%o A280408 for n in range(1, 21): print(a(n)) # _Indranil Ghosh_, Apr 14 2017
%Y A280408 Cf. A070165, A280409.
%K A280408 tabf,nonn
%O A280408 1,1
%A A280408 _Matthew Campbell_, Jan 02 2017