A035306 List prime factors of each number in order (each prime factor is followed by its power). Start with 1 = {1,1}.
1, 1, 2, 1, 3, 1, 2, 2, 5, 1, 2, 1, 3, 1, 7, 1, 2, 3, 3, 2, 2, 1, 5, 1, 11, 1, 2, 2, 3, 1, 13, 1, 2, 1, 7, 1, 3, 1, 5, 1, 2, 4, 17, 1, 2, 1, 3, 2, 19, 1, 2, 2, 5, 1, 3, 1, 7, 1, 2, 1, 11, 1, 23, 1, 2, 3, 3, 1, 5, 2, 2, 1, 13, 1, 3, 3, 2, 2, 7, 1, 29, 1, 2, 1, 3, 1, 5, 1, 31, 1, 2, 5, 3, 1, 11, 1, 2
Offset: 1
Examples
The table starts as follows: n | (p, valuation_p(n)) for primes p | n ----+--------------------------------------- 1 | (1, 1), (row 1, by definition of this sequence) 2 | (2, 1), (i.e.: 2 = 2^1) 3 | (3, 1), 4 | (2, 2), (i.e.: 4 = 2^2) 5 | (5, 1), 6 | (2, 1), (3, 1), (i.e.: 6 = 2^1 * 3^2) 7 | (7, 1), 8 | (2, 3), 9 | (3, 2), 10 | (2, 1), (5, 1), 11 | (11, 1), 12 | (2, 2), (3, 1), 13 | (13, 1), 14 | (2, 1), (7, 1), 15 | (3, 1), (5, 1), 16 | (2, 4), 17 | (17, 1), 18 | (2, 1), (3, 2), ... | ...
Links
- Reinhard Zumkeller, Rows n = 1..1000 of triangle, flattened
Programs
-
Haskell
import Data.List (transpose) a035306 n k = a035306_row n !! (k-1) a035306_row 1 = [1,1] a035306_row n = concat $ transpose [a027748_row n, a124010_row n] a035306_tabf = map a035306_row [1..] -- Reinhard Zumkeller, Jan 10 2013
-
Magma
[ Factorization(n) : n in [1..120]];
-
Maple
ListTools[Flatten]([[[1, 1]], seq(op(2..-1, ifactors(n)), n=2..34)], 2); # Peter Luschny, Sep 02 2018
-
Mathematica
Flatten[ Array[ FactorInteger[ # ]&, 40 ] ]
-
PARI
upto(n) = {n = max(n, 1); my(res = List([1, 1])); for(i = 2, n, f = factor(i); for(j = 1, #f~, listput(res, f[j, 1]); listput(res, f[j, 2]))); res} \\ David A. Corneth, Sep 02 2018
-
PARI
A035306_row(n)=if(n>1, concat(Col(factor(n))~), [1, 1]) \\ M. F. Hasler, Jun 04 2024
-
Python
A035306_row = lambda n: [x for f in factorint(n).items() for x in f] from sympy import factorint # M. F. Hasler, Jun 06 2024
Formula
For 1 <= k <= A001221(n): T(n,2*k-1) = A027748(n,k), T(n,2*k) = A124010(n,k). - Reinhard Zumkeller, Jan 10 2013
Comments