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.

Showing 1-10 of 8005 results. Next

A112798 Table where n-th row is factorization of n, with each prime p_i replaced by i.

Original entry on oeis.org

1, 2, 1, 1, 3, 1, 2, 4, 1, 1, 1, 2, 2, 1, 3, 5, 1, 1, 2, 6, 1, 4, 2, 3, 1, 1, 1, 1, 7, 1, 2, 2, 8, 1, 1, 3, 2, 4, 1, 5, 9, 1, 1, 1, 2, 3, 3, 1, 6, 2, 2, 2, 1, 1, 4, 10, 1, 2, 3, 11, 1, 1, 1, 1, 1, 2, 5, 1, 7, 3, 4, 1, 1, 2, 2, 12, 1, 8, 2, 6, 1, 1, 1, 3, 13, 1, 2, 4, 14, 1, 1, 5, 2, 2, 3, 1, 9, 15, 1, 1, 1, 1
Offset: 2

Views

Author

Keywords

Comments

This is an enumeration of all partitions.
Technically this is an enumeration of all multisets (finite weakly increasing sequences of positive integers) rather than integer partitions. - Gus Wiseman, Dec 12 2016
A000040(a(n)) is a prime factor of A082288(n). - Reinhard Zumkeller, Feb 03 2008
Row n is the partition with Heinz number n. We define the Heinz number of a partition p = [p_1, p_2, ..., p_r] as Product(p_j-th prime, j=1..r) (concept used by Alois P. Heinz in A215366 as an "encoding" of a partition). For example, for the partition [1, 1, 2, 4, 10] we get 2*2*3*7*29 = 2436. For a given n, the 2nd Maple program yields row n; for example, we obtain at once B(2436) = [1,1,2,4,10]. - Emeric Deutsch, Jun 04 2015
From Emeric Deutsch, May 05 2015: (Start)
Number of entries in row n is bigomega(n) (i.e., the number of prime factors of n, multiplicities included).
Product of entries in row n = A003963(n).
Row n contains the Matula numbers of the rooted trees obtained from the rooted tree with Matula number n by deleting the edges emanating from the root. Example: row 8 is 1,1,1; indeed the rooted tree with Matula number 8 is \|/ and deleting the edges emanating from the root we obtain three one-vertex trees, having Matula numbers 1, 1, 1. Example: row 7 is 4; indeed, the rooted tree with Matula number 7 is Y and deleting the edges emanating from the root we obtain the rooted tree V, having Matula number 4.
The Matula (or Matula-Goebel) number of a rooted tree can be defined in the following recursive manner: to the one-vertex tree there corresponds the number 1; to a tree T with root degree 1 there corresponds the t-th prime number, where t is the Matula-Goebel number of the tree obtained from T by deleting the edge emanating from the root; to a tree T with root degree m >= 2 there corresponds the product of the Matula-Goebel numbers of the m branches of T. (End)

Examples

			Row 20 is 1,1,3 because the prime factors of 20, namely 2,2,5 are the 1st, 1st, 3rd primes.
Table begins:
  1;
  2;
  1, 1;
  3;
  1, 2;
  4;
  1, 1, 1;
  ...
The sequence of all finite multisets of positive integers begins: (), (1), (2), (11), (3), (12), (4), (111), (22), (13), (5), (112), (6), (14), (23), (1111), (7), (122), (8), (113), (24), (15), (9), (1112), (33), (16), (222), (114). - _Gus Wiseman_, Dec 12 2016
		

Crossrefs

Row lengths are A001222. Cf. A000040, A027746, A000720, A036036.
Cf. A056239 (row sums).
Cf. A003963 (row products).

Programs

  • Haskell
    a112798 n k = a112798_tabf !! (n-2) !! (n-1)
    a112798_row n = a112798_tabf !! (n-2)
    a112798_tabf = map (map a049084) $ tail a027746_tabf
    -- Reinhard Zumkeller, Aug 04 2014
    
  • Maple
    T:= n-> sort([seq(numtheory[pi](i[1])$i[2], i=ifactors(n)[2])])[]:
    seq(T(n), n=2..50);  # Alois P. Heinz, Aug 09 2012
    with(numtheory): B := proc (n) local nn, j, m: nn := op(2, ifactors(n)); for j to nops(nn) do m[j] := op(j, nn) end do: [seq(seq(pi(op(1, m[i])), q = 1 .. op(2, m[i])), i = 1 .. nops(nn))] end proc: # Emeric Deutsch, Jun 04 2015. (This is equivalent to the first Maple program.)
  • Mathematica
    PrimePi /@ Flatten[Table[#1, {#2}] & @@@ FactorInteger@ #] & /@ Range@ 60 // Flatten // Rest (* Michael De Vlieger, May 09 2015 *)
  • PARI
    row(n)=my(v=List(),f=factor(n)); for(i=1,#f~,for(j=1,f[i,2], listput(v,primepi(f[i,1])))); Vec(v) \\ Charles R Greathouse IV, Nov 09 2021

Formula

T(n,k) = A000720(A027746(n,k)); A027746(n,k) = A000040(T(n,k)).
Also T(n,k) = A049084(A027746(n,k)). - Reinhard Zumkeller, Aug 04 2014

A027750 Triangle read by rows in which row n lists the divisors of n.

Original entry on oeis.org

1, 1, 2, 1, 3, 1, 2, 4, 1, 5, 1, 2, 3, 6, 1, 7, 1, 2, 4, 8, 1, 3, 9, 1, 2, 5, 10, 1, 11, 1, 2, 3, 4, 6, 12, 1, 13, 1, 2, 7, 14, 1, 3, 5, 15, 1, 2, 4, 8, 16, 1, 17, 1, 2, 3, 6, 9, 18, 1, 19, 1, 2, 4, 5, 10, 20, 1, 3, 7, 21, 1, 2, 11, 22, 1, 23, 1, 2, 3, 4, 6, 8, 12, 24, 1, 5, 25, 1, 2, 13, 26, 1, 3, 9, 27, 1, 2, 4, 7, 14, 28, 1, 29
Offset: 1

Views

Author

Keywords

Comments

Or, in the list of natural numbers (A000027), replace n with its divisors.
This gives the first elements of the ordered pairs (a,b) a >= 1, b >= 1 ordered by their product ab.
Also, row n lists the largest parts of the partitions of n whose parts are not distinct. - Omar E. Pol, Sep 17 2008
Concatenation of n-th row gives A037278(n). - Reinhard Zumkeller, Aug 07 2011
{A210208(n,k): k=1..A073093(n)} subset of {T(n,k): k=1..A000005(n)} for all n. - Reinhard Zumkeller, Mar 18 2012
Row sums give A000203. Right border gives A000027. - Omar E. Pol, Jul 29 2012
Indices of records are in A006218. - Irina Gerasimova, Feb 27 2013
The number of primes in the n-th row is omega(n) = A001221(n). - Michel Marcus, Oct 21 2015
The row polynomials P(n,x) = Sum_{k=1..A000005(n)} T(n,k)*x^k with composite n which are irreducible over the integers are given in A292226. - Wolfdieter Lang, Nov 09 2017
T(n,k) is also the number of parts in the k-th partition of n into equal parts (see example). - Omar E. Pol, Nov 20 2019
Let there be an infinite number of tiles, each labeled with a positive integer m, initially placed on square m of an infinite 1D board. At step n, the leftmost unblocked tile (i.e., the top tile of the leftmost nonempty stack) moves forward exactly m squares, where m is its label. Tiles that land on the same square form a stack, and only the top tile of any stack may move. This sequence records the label m of the tile that moves at step n. - Ali Sada, May 23 2025
All divisors of a positive integer n form a finite set. Extending divisibility to n = 0 by using the definition (k|n <=> exists m such that m*k = n) makes the set of divisors infinite, suggesting the definition was not intended for zero, as arithmetic functions typically apply to n >= 1. So to preserve a core property when generalizing (cardinality), one can define divisors of n >= 0 as the fixed points of the greatest common divisor on the set [n] = {0, 1, 2, ..., n}. By this definition, the divisors of 0 are {0}, since 0|0 and gcd(0, 0) = 0. This definition is not circular because the gcd can be effectively calculated using the Euclidean algorithm. (Cf. links.) - Peter Luschny, Jun 02 2025

Examples

			Triangle begins:
  1;
  1, 2;
  1, 3;
  1, 2, 4;
  1, 5;
  1, 2, 3, 6;
  1, 7;
  1, 2, 4, 8;
  1, 3, 9;
  1, 2, 5, 10;
  1, 11;
  1, 2, 3, 4, 6, 12;
  ...
For n = 6 the partitions of 6 into equal parts are [6], [3,3], [2,2,2], [1,1,1,1,1,1], so the number of parts are [1, 2, 3, 6] respectively, the same as the divisors of 6. - _Omar E. Pol_, Nov 20 2019
		

Crossrefs

Cf. A000005 (row length), A001221, A027749, A027751, A056534, A056538, A127093, A135010, A161700, A163280, A240698 (partial sums of rows), A240694 (partial products of rows), A247795 (parities), A292226, A244051.

Programs

  • Haskell
    a027750 n k = a027750_row n !! (k-1)
    a027750_row n = filter ((== 0) . (mod n)) [1..n]
    a027750_tabf = map a027750_row [1..]
    -- Reinhard Zumkeller, Jan 15 2011, Oct 21 2010
    
  • Magma
    [Divisors(n) : n in [1..20]];
    
  • Maple
    seq(op(numtheory:-divisors(a)), a = 1 .. 20) # Matt C. Anderson, May 15 2017
  • Mathematica
    Flatten[ Table[ Flatten [ Divisors[ n ] ], {n, 1, 30} ] ]
  • PARI
    v=List();for(n=1,20,fordiv(n,d,listput(v,d)));Vec(v) \\ Charles R Greathouse IV, Apr 28 2011
    
  • Python
    from sympy import divisors
    for n in range(1, 16):
        print(divisors(n)) # Indranil Ghosh, Mar 30 2017

Formula

a(A006218(n-1) + k) = k-divisor of n, 1 <= k <= A000005(n). - Reinhard Zumkeller, May 10 2006
T(n,k) = n / A056538(n,k) = A056538(n,n-k+1), 1 <= k <= A000005(n). - Reinhard Zumkeller, Sep 28 2014

Extensions

More terms from Scott Lindhurst (ScottL(AT)alumni.princeton.edu)

A237593 Triangle read by rows in which row n lists the elements of the n-th row of A237591 followed by the same elements in reverse order.

Original entry on oeis.org

1, 1, 2, 2, 2, 1, 1, 2, 3, 1, 1, 3, 3, 2, 2, 3, 4, 1, 1, 1, 1, 4, 4, 2, 1, 1, 2, 4, 5, 2, 1, 1, 2, 5, 5, 2, 2, 2, 2, 5, 6, 2, 1, 1, 1, 1, 2, 6, 6, 3, 1, 1, 1, 1, 3, 6, 7, 2, 2, 1, 1, 2, 2, 7, 7, 3, 2, 1, 1, 2, 3, 7, 8, 3, 1, 2, 2, 1, 3, 8, 8, 3, 2, 1, 1, 1, 1, 2, 3, 8
Offset: 1

Views

Author

Omar E. Pol, Feb 22 2014

Keywords

Comments

Row n is a palindromic composition of 2*n.
T(n,k) is also the length of the k-th segment in a Dyck path on the first quadrant of the square grid, connecting the x-axis with the y-axis, from (n, 0) to (0, n), starting with a segment in vertical direction, see example.
Conjecture 1: the area under the n-th Dyck path equals A024916(n), the sum of all divisors of all positive integers <= n.
If the conjecture is true then the n-th Dyck path represents the boundary segments after the alternating sum of the elements of the n-th row of A236104.
Conjecture 2: two adjacent Dyck paths never cross (checked by hand up to n = 128), hence the total area between the n-th Dyck path and the (n-1)-st Dyck path is equal to sigma(n) = A000203(n), the sum of divisors of n.
The connection between A196020 and A237271 is as follows: A196020 --> A236104 --> A235791 --> A237591 --> this sequence --> A239660 --> A237270 --> A237271.
PARI scripts area(n) and chkcross(n) have been written to check the 2 properties and have been run up to n=10000. - Michel Marcus, Mar 27 2014
Mathematica functions have been written that verified the 2 properties through n=30000. - Hartmut F. W. Hoft, Apr 07 2014
Comments from Franklin T. Adams-Watters on sequences related to the "symmetric representation of sigma" in A235791 and related sequences, Mar 31 2014: (Start)
The place to start is with A235791, which is very simple. Then go to A237591, also very simple, and A237593, still very simple.
You then need to interpret the rows of A237593 as Dyck paths. This interpretation is in terms of run lengths, so 2,1,1,2 means up twice, down once, up once, and down twice. Because the rows of A237593 are symmetric and of even length, this path will always be symmetric.
Now the surprising fact is that the areas enclosed by the Dyck path for n (laid on its side) always includes the area enclosed for n-1; and the number of squares added is sigma(n).
Finally, look at the connected areas enclosed by n but not by n-1; the size of these areas is the symmetric representation of sigma. (End)
The symmetric representation of sigma, so defined, is row n of A237270. - Peter Munn, Jan 06 2025
It appears that, for the n-th set, the number of cells lying on the first diagonal is equal to A067742(n), the number of middle divisors of n. - Michel Marcus, Jun 21 2014
Checked Michel Marcus's conjecture with two Mathematica functions up to n=100000, for more information see A240542. - Hartmut F. W. Hoft, Jul 17 2014
A003056(n) is also the number of peaks of the Dyck path related to the n-th row of triangle. - Omar E. Pol, Nov 03 2015
The number of peaks of the Dyck path associated to the row A000396(n) of this triangle equals the n-th Mersenne prime A000668(n), hence Mersenne primes are visible in two ways at the pyramid described in A245092. - Omar E. Pol, Dec 19 2016
The limit as n approaches infinity (area under the Dyck path described in the n-th row of triangle divided by n^2) equals Pi^2/12 = zeta(2)/2. (Cf. A072691.) - Omar E. Pol, Dec 18 2021
The connection between the isosceles triangle and the stepped pyramid is due to the fact that this object can also be interpreted as a pop-up card. - Omar E. Pol, Nov 09 2022

Examples

			Triangle begins:
   n
   1 |  1, 1;
   2 |  2, 2;
   3 |  2, 1, 1, 2;
   4 |  3, 1, 1, 3;
   5 |  3, 2, 2, 3;
   6 |  4, 1, 1, 1, 1, 4;
   7 |  4, 2, 1, 1, 2, 4;
   8 |  5, 2, 1, 1, 2, 5;
   9 |  5, 2, 2, 2, 2, 5;
  10 |  6, 2, 1, 1, 1, 1, 2, 6;
  11 |  6, 3, 1, 1, 1, 1, 3, 6;
  12 |  7, 2, 2, 1, 1, 2, 2, 7;
  13 |  7, 3, 2, 1, 1, 2, 3, 7;
  14 |  8, 3, 1, 2, 2, 1, 3, 8;
  15 |  8, 3, 2, 1, 1, 1, 1, 2, 3, 8;
  16 |  9, 3, 2, 1, 1, 1, 1, 2, 3, 9;
  17 |  9, 4, 2, 1, 1, 1, 1, 2, 4, 9;
  18 | 10, 3, 2, 2, 1, 1, 2, 2, 3, 10;
  19 | 10, 4, 2, 2, 1, 1, 2, 2, 4, 10;
  20 | 11, 4, 2, 1, 2, 2, 1, 2, 4, 11;
  21 | 11, 4, 3, 1, 1, 1, 1, 1, 1, 3, 4, 11;
  22 | 12, 4, 2, 2, 1, 1, 1, 1, 2, 2, 4, 12;
  23 | 12, 5, 2, 2, 1, 1, 1, 1, 2, 2, 5, 12;
  24 | 13, 4, 3, 2, 1, 1, 1, 1, 2, 3, 4, 13;
  ...
Illustration of rows 8 and 9 interpreted as Dyck paths in the first quadrant and the illustration of the symmetric representation of sigma(9) = 5 + 3 + 5 = 13, see below:
.
y                       y
.                       .
.                       ._ _ _ _ _                _ _ _ _ _ 5
._ _ _ _ _              .         |              |_ _ _ _ _|
.         |             .         |_ _                     |_ _ 3
.         |_            .             |                    |_  |
.           |_ _        .             |_ _                   |_|_ _ 5
.               |       .                 |                      | |
.   Area = 56   |       .    Area = 69    |          Area = 13   | |
.               |       .                 |                      | |
.               |       .                 |                      | |
. . . . . . . . | . x   . . . . . . . . . | . x                  |_|
.
.    Fig. 1                    Fig. 2                  Fig. 3
.
Figure 1. For n = 8 the 8th row of triangle is [5, 2, 1, 1, 2, 5] and the area under the symmetric Dyck path is equal to A024916(8) = 56.
Figure 2. For n = 9 the 9th row of triangle is [5, 2, 2, 2, 2, 5] and the area under the symmetric Dyck path is equal to A024916(9) = 69.
Figure 3. The symmetric representation of sigma(9): between both symmetric Dyck paths there are three regions (or parts) of sizes [5, 3, 5].
The sum of divisors of 9 is 1 + 3 + 9 = A000203(9) = 13. On the other hand the difference between the areas under the Dyck paths equals the sum of the parts of the symmetric representation of sigma(9) = 69 - 56 = 5 + 3 + 5 = 13, equaling the sum of divisors of 9.
.
Illustration of initial terms as Dyck paths in the first quadrant:
(row n = 1..28)
.  _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
  |_ _ _ _ _ _ _ _ _ _ _ _ _ _  |
  |_ _ _ _ _ _ _ _ _ _ _ _ _ _| |
  |_ _ _ _ _ _ _ _ _ _ _ _ _  | |
  |_ _ _ _ _ _ _ _ _ _ _ _ _| | |
  |_ _ _ _ _ _ _ _ _ _ _ _  | | |_ _ _
  |_ _ _ _ _ _ _ _ _ _ _ _| | |_ _ _  |
  |_ _ _ _ _ _ _ _ _ _ _  | | |_ _  | |_
  |_ _ _ _ _ _ _ _ _ _ _| | |_ _ _| |_  |_
  |_ _ _ _ _ _ _ _ _ _  | |       |_ _|   |_
  |_ _ _ _ _ _ _ _ _ _| | |_ _    |_  |_ _  |_ _
  |_ _ _ _ _ _ _ _ _  | |_ _ _|     |_  | |_ _  |
  |_ _ _ _ _ _ _ _ _| | |_ _  |_      |_|_ _  | |
  |_ _ _ _ _ _ _ _  | |_ _  |_ _|_        | | | |_ _ _ _ _
  |_ _ _ _ _ _ _ _| |     |     | |_ _    | |_|_ _ _ _ _  |
  |_ _ _ _ _ _ _  | |_ _  |_    |_  | |   |_ _ _ _ _  | | |
  |_ _ _ _ _ _ _| |_ _  |_  |_ _  | | |_ _ _ _ _  | | | | |
  |_ _ _ _ _ _  | |_  |_  |_    | |_|_ _ _ _  | | | | | | |
  |_ _ _ _ _ _| |_ _|   |_  |   |_ _ _ _  | | | | | | | | |
  |_ _ _ _ _  |     |_ _  | |_ _ _ _  | | | | | | | | | | |
  |_ _ _ _ _| |_      | |_|_ _ _  | | | | | | | | | | | | |
  |_ _ _ _  |_ _|_    |_ _ _  | | | | | | | | | | | | | | |
  |_ _ _ _| |_  | |_ _ _  | | | | | | | | | | | | | | | | |
  |_ _ _  |_  |_|_ _  | | | | | | | | | | | | | | | | | | |
  |_ _ _|   |_ _  | | | | | | | | | | | | | | | | | | | | |
  |_ _  |_ _  | | | | | | | | | | | | | | | | | | | | | | |
  |_ _|_  | | | | | | | | | | | | | | | | | | | | | | | | |
  |_  | | | | | | | | | | | | | | | | | | | | | | | | | | |
  |_|_|_|_|_|_|_|_|_|_|_|_|_|_|_|_|_|_|_|_|_|_|_|_|_|_|_|_|
.
n: 1 2 3 4 5 6 7 8 9 10..12..14..16..18..20..22..24..26..28
.
It appears that the total area (also the total number of cells) in the first n set of symmetric regions of the diagram is equal to A024916(n), the sum of all divisors of all positive integers <= n.
It appears that the total area (also the total number of cells) in the n-th set of symmetric regions of the diagram is equal to sigma(n) = A000203(n) (checked by hand up n = 128).
From _Omar E. Pol_, Aug 18 2015: (Start)
The above diagram is also the top view of the stepped pyramid described in A245092 and it is also the top view of the staircase described in A244580, in both cases the figure represents the first 28 levels of the structure. Note that the diagram contains (and arises from) a hidden pattern which is shown below.
.
Illustration of initial terms as an isosceles triangle:
Row                                 _ _
1                                 _|1|1|_
2                               _|2 _|_ 2|_
3                             _|2  |1|1|  2|_
4                           _|3   _|1|1|_   3|_
5                         _|3    |2 _|_ 2|    3|_
6                       _|4     _|1|1|1|1|_     4|_
7                     _|4      |2  |1|1|  2|      4|_
8                   _|5       _|2 _|1|1|_ 2|_       5|_
9                 _|5        |2  |2 _|_ 2|  2|        5|_
10              _|6         _|2  |1|1|1|1|  2|_         6|_
11            _|6          |3   _|1|1|1|1|_   3|          6|_
12          _|7           _|2  |2  |1|1|  2|  2|_           7|_
13        _|7            |3    |2 _|1|1|_ 2|    3|            7|_
14      _|8             _|3   _|1|2 _|_ 2|1|_   3|_             8|_
15    _|8              |3    |2  |1|1|1|1|  2|    3|              8|_
16   |9                |3    |2  |1|1|1|1|  2|    3|                9|
...
This diagram is the simpler representation of the sequence.
The number of horizontal line segments in the n-th level in each side of the diagram equals A001227(n), the number of odd divisors of n.
The number of horizontal line segments in the left side of the diagram plus the number of the horizontal line segment in the right side equals A054844(n).
The total number of vertical line segments in the n-th level of the diagram equals A131507(n).
Note that this symmetric pattern also emerges from the front view of the stepped pyramid described in A245092, which is related to sigma A000203, the sum-of-divisors function, and other related sequences. The diagram represents the first 16 levels of the pyramid. (End)
		

Crossrefs

Row n has length 2*A003056(n).
Row sums give A005843, n >= 1.
Column k starts in row A008805(k-1).
Column 1 = right border = A008619, n >= 1.
Bisections are in A259176, A259177.
For further information see A262626.

Programs

  • Mathematica
    row[n_]:=Floor[(Sqrt[8n+1]-1)/2]
    s[n_,k_]:=Ceiling[(n+1)/k-(k+1)/2]-Ceiling[(n+1)/(k+1)-(k+2)/2]
    f[n_,k_]:=If[k<=row[n],s[n,k],s[n,2 row[n]+1-k]]
    TableForm[Table[f[n,k],{n,1,50},{k,1,2 row[n]}]] (* Hartmut F. W. Hoft, Apr 08 2014 *)
  • PARI
    row(n) = {my(orow = row237591(n)); vector(2*#orow, i, if (i <= #orow, orow[i], orow[2*#orow-i+1]));}
    area(n) = {my(rown = row(n)); surf = 0; h = n; odd = 1; for (i=1, #row, if (odd, surf += h*rown[i], h -= rown[i];); odd = !odd;); surf;}
    heights(v, n) = {vh = vector(n); ivh = 1; h = n; odd = 1; for (i=1, #v, if (odd, for (j=1, v[i], vh[ivh] = h; ivh++), h -= v[i];); odd = !odd;); vh;}
    isabove(hb, ha) = {for (i=1, #hb, if (hb[i] < ha[i], return (0));); return (1);}
    chkcross(nn) = {hga = concat(heights(row(1), 1), 0); for (n=2, nn, hgb = heights(row(n), n); if (! isabove(hgb, hga), print("pb cross at n=", n)); hga = concat(hgb, 0););} \\ Michel Marcus, Mar 27 2014
    
  • Python
    from sympy import sqrt
    import math
    def row(n): return int(math.floor((sqrt(8*n + 1) - 1)/2))
    def s(n, k): return int(math.ceil((n + 1)/k - (k + 1)/2)) - int(math.ceil((n + 1)/(k + 1) - (k + 2)/2))
    def T(n, k): return s(n, k) if k<=row(n) else s(n, 2*row(n) + 1 - k)
    for n in range(1, 11): print([T(n, k) for k in range(1, 2*row(n) + 1)]) # Indranil Ghosh, Apr 21 2017

Formula

Let j(n)= floor((sqrt(8n+1)-1)/2) then T(n,k) = A237591(n,k), if k <= j(n); otherwise T(n,k) = A237591(n,2*j(n)+1-k). - Hartmut F. W. Hoft, Apr 07 2014 (corrected by Omar E. Pol, May 31 2015)

Extensions

A minor edit to the definition. - N. J. A. Sloane, Jul 31 2025

A005940 The Doudna sequence: write n-1 in binary; power of prime(k) in a(n) is # of 1's that are followed by k-1 0's.

Original entry on oeis.org

1, 2, 3, 4, 5, 6, 9, 8, 7, 10, 15, 12, 25, 18, 27, 16, 11, 14, 21, 20, 35, 30, 45, 24, 49, 50, 75, 36, 125, 54, 81, 32, 13, 22, 33, 28, 55, 42, 63, 40, 77, 70, 105, 60, 175, 90, 135, 48, 121, 98, 147, 100, 245, 150, 225, 72, 343, 250, 375, 108, 625, 162, 243, 64, 17, 26, 39
Offset: 1

Views

Author

Keywords

Comments

A permutation of the natural numbers. - Robert G. Wilson v, Feb 22 2005
Fixed points: A029747. - Reinhard Zumkeller, Aug 23 2006
The even bisection, when halved, gives the sequence back. - Antti Karttunen, Jun 28 2014
From Antti Karttunen, Dec 21 2014: (Start)
This irregular table can be represented as a binary tree. Each child to the left is obtained by applying A003961 to the parent, and each child to the right is obtained by doubling the parent:
1
|
...................2...................
3 4
5......../ \........6 9......../ \........8
/ \ / \ / \ / \
/ \ / \ / \ / \
/ \ / \ / \ / \
7 10 15 12 25 18 27 16
11 14 21 20 35 30 45 24 49 50 75 36 125 54 81 32
etc.
Sequence A163511 is obtained by scanning the same tree level by level, from right to left. Also in binary trees A253563 and A253565 the terms on level of the tree are some permutation of the terms present on the level n of this tree. A252464(n) gives the distance of n from 1 in all these trees.
A252737(n) gives the sum and A252738(n) the product of terms on row n (where 1 is on row 0, 2 on row 1, 3 and 4 on row 2, etc.). A252745(n) gives the number of nodes on level n whose left child is larger than the right child, A252750 the difference between left and right child for each node from node 2 onward.
(End)
-A008836(a(1+n)) gives the corresponding numerator for A323505(n). - Antti Karttunen, Jan 19 2019
(a(2n+1)-1)/2 [= A244154(n)-1, for n >= 0] is a permutation of the natural numbers. - George Beck and Antti Karttunen, Dec 08 2019
From Peter Munn, Oct 04 2020: (Start)
Each term has the same even part (equivalently, the same 2-adic valuation) as its index.
Using the tree depicted in Antti Karttunen's 2014 comment:
Numbers are on the right branch (4 and descendants) if and only if divisible by the square of their largest prime factor (cf. A070003).
Numbers on the left branch, together with 2, are listed in A102750.
(End)
According to Kutz (1981), he learned of this sequence from American mathematician Byron Leon McAllister (1929-2017) who attributed the invention of the sequence to a graduate student by the name of Doudna (first name Paul?) in the mid-1950's at the University of Wisconsin. - Amiram Eldar, Jun 17 2021
From David James Sycamore, Sep 23 2022: (Start)
Alternative (recursive) definition: If n is a power of 2 then a(n)=n. Otherwise, if 2^j is the greatest power of 2 not exceeding n, and if k = n - 2^j, then a(n) is the least m*a(k) that has not occurred previously, where m is an odd prime.
Example: Use recursion with n = 77 = 2^6 + 13. a(13) = 25 and since 11 is the smallest odd prime m such that m*a(13) has not already occurred (see a(27), a(29),a(45)), then a(77) = 11*25 = 275. (End)
The odd bisection, when transformed by replacing all prime(k)^e in a(2*n - 1) with prime(k-1)^e, returns a(n), and thus gives the sequence back. - David James Sycamore, Sep 28 2022

Examples

			From _N. J. A. Sloane_, Aug 22 2022: (Start)
Let c_i = number of 1's in binary expansion of n-1 that have i 0's to their right, and let p(j) = j-th prime.  Then a(n) = Product_i p(i+1)^c_i.
If n=9, n-1 is 1000, c_3 = 1, a(9) = p(4)^1 = 7.
If n=10, n-1 = 1001, c_0 = 1, c_2 = 1, a(10) = p(1)*p(3) = 2*5 = 10.
If n=11, n-1 = 1010, c_1 = 1, c_2 = 1, a(11) = p(2)*p(3) = 15. (End)
		

References

  • N. J. A. Sloane and Simon Plouffe, The Encyclopedia of Integer Sequences, Academic Press, 1995 (includes this sequence).

Crossrefs

Cf. A103969. Inverse is A005941 (A156552).
Cf. A125106. [From Franklin T. Adams-Watters, Mar 06 2010]
Cf. A252737 (gives row sums), A252738 (row products), A332979 (largest on row).
Related permutations of positive integers: A163511 (via A054429), A243353 (via A006068), A244154, A253563 (via A122111), A253565, A332977, A334866 (via A225546).
A000120, A003602, A003961, A006519, A053645, A070939, A246278, A250246, A252753, A253552 are used in a formula defining this sequence.
Formulas for f(a(n)) are given for f = A000265, A003963, A007949, A055396, A056239.
Numbers that occur at notable sets of positions in the binary tree representation of the sequence: A000040, A000079, A002110, A070003, A070826, A102750.
Cf. A106737, A290077, A323915, A324052, A324054, A324055, A324056, A324057, A324058, A324114, A324335, A324340, A324348, A324349 for various number-theoretical sequences applied to (i.e., permuted by) this sequence.
k-adic valuation: A007814 (k=2), A337821 (k=3).
Positions of multiples of 3: A091067.
Primorial deflation: A337376 / A337377.
Sum of prime indices of a(n) is A161511, reverse version A359043.
A048793 lists binary indices, ranked by A019565.
A066099 lists standard comps, partial sums A358134 (ranked by A358170).

Programs

  • Haskell
    a005940 n = f (n - 1) 1 1 where
       f 0 y _          = y
       f x y i | m == 0 = f x' y (i + 1)
               | m == 1 = f x' (y * a000040 i) i
               where (x',m) = divMod x 2
    -- Reinhard Zumkeller, Oct 03 2012
    (Scheme, with memoization-macro definec from Antti Karttunen's IntSeq-library)
    (define (A005940 n) (A005940off0 (- n 1))) ;; The off=1 version, utilizing any one of three different offset-0 implementations:
    (definec (A005940off0 n) (cond ((< n 2) (+ 1 n)) (else (* (A000040 (- (A070939 n) (- (A000120 n) 1))) (A005940off0 (A053645 n))))))
    (definec (A005940off0 n) (cond ((<= n 2) (+ 1 n)) ((even? n) (A003961 (A005940off0 (/ n 2)))) (else (* 2 (A005940off0 (/ (- n 1) 2))))))
    (define (A005940off0 n) (let loop ((n n) (i 1) (x 1)) (cond ((zero? n) x) ((even? n) (loop (/ n 2) (+ i 1) x)) (else (loop (/ (- n 1) 2) i (* x (A000040 i)))))))
    ;; Antti Karttunen, Jun 26 2014
    
  • Maple
    f := proc(n,i,x) option remember ; if n = 0 then x; elif type(n,'even') then procname(n/2,i+1,x) ; else procname((n-1)/2,i,x*ithprime(i)) ; end if; end proc:
    A005940 := proc(n) f(n-1,1,1) ; end proc: # R. J. Mathar, Mar 06 2010
  • Mathematica
    f[n_] := Block[{p = Partition[ Split[ Join[ IntegerDigits[n - 1, 2], {2}]], 2]}, Times @@ Flatten[ Table[q = Take[p, -i]; Prime[ Count[ Flatten[q], 0] + 1]^q[[1, 1]], {i, Length[p]}] ]]; Table[ f[n], {n, 67}] (* Robert G. Wilson v, Feb 22 2005 *)
    Table[Times@@Prime/@(Join@@Position[Reverse[IntegerDigits[n,2]],1]-Range[DigitCount[n,2,1]]+1),{n,0,100}] (* Gus Wiseman, Dec 28 2022 *)
  • PARI
    A005940(n) = { my(p=2, t=1); n--; until(!n\=2, n%2 && (t*=p) || p=nextprime(p+1)); t } \\ M. F. Hasler, Mar 07 2010; update Aug 29 2014
    
  • PARI
    a(n)=my(p=2, t=1); for(i=0,exponent(n), if(bittest(n,i), t*=p, p=nextprime(p+1))); t \\ Charles R Greathouse IV, Nov 11 2021
    
  • Python
    from sympy import prime
    import math
    def A(n): return n - 2**int(math.floor(math.log(n, 2)))
    def b(n): return n + 1 if n<2 else prime(1 + (len(bin(n)[2:]) - bin(n)[2:].count("1"))) * b(A(n))
    print([b(n - 1) for n in range(1, 101)]) # Indranil Ghosh, Apr 10 2017
    
  • Python
    from math import prod
    from itertools import accumulate
    from collections import Counter
    from sympy import prime
    def A005940(n): return prod(prime(len(a)+1)**b for a, b in Counter(accumulate(bin(n-1)[2:].split('1')[:0:-1])).items()) # Chai Wah Wu, Mar 10 2023

Formula

From Reinhard Zumkeller, Aug 23 2006, R. J. Mathar, Mar 06 2010: (Start)
a(n) = f(n-1, 1, 1)
where f(n, i, x) = x if n = 0,
= f(n/2, i+1, x) if n > 0 is even
= f((n-1)/2, i, x*prime(i)) otherwise. (End)
From Antti Karttunen, Jun 26 2014: (Start)
Define a starting-offset 0 version of this sequence as:
b(0)=1, b(1)=2, [base cases]
and then compute the rest either with recurrence:
b(n) = A000040(1+(A070939(n)-A000120(n))) * b(A053645(n)).
or
b(2n) = A003961(b(n)), b(2n+1) = 2 * b(n). [Compare this to the similar recurrence given for A163511.]
Then define a(n) = b(n-1), where a(n) gives this sequence A005940 with the starting offset 1.
Can be also defined as a composition of related permutations:
a(n+1) = A243353(A006068(n)).
a(n+1) = A163511(A054429(n)). [Compare the scatter plots of this sequence and A163511 to each other.]
This permutation also maps between the partitions as enumerated in the lists A125106 and A112798, providing identities between:
A161511(n) = A056239(a(n+1)). [The corresponding sums ...]
A243499(n) = A003963(a(n+1)). [... and the products of parts of those partitions.]
(End)
From Antti Karttunen, Dec 21 2014 - Jan 04 2015: (Start)
A002110(n) = a(1+A002450(n)). [Primorials occur at (4^n - 1)/3 in the offset-0 version of the sequence.]
a(n) = A250246(A252753(n-1)).
a(n) = A122111(A253563(n-1)).
For n >= 1, A055396(a(n+1)) = A001511(n).
For n >= 2, a(n) = A246278(1+A253552(n)).
(End)
From Peter Munn, Oct 04 2020: (Start)
A000265(a(n)) = a(A000265(n)) = A003961(a(A003602(n))).
A006519(a(n)) = a(A006519(n)) = A006519(n).
a(n) = A003961(a(A003602(n))) * A006519(n).
A007814(a(n)) = A007814(n).
A007949(a(n)) = A337821(n) = A007814(A003602(n)).
a(n) = A225546(A334866(n-1)).
(End)
a(2n) = 2*a(n), or generally a(2^k*n) = 2^k*a(n). - Amiram Eldar, Oct 03 2022
If n-1 = Sum_{i} 2^(q_i-1), then a(n) = Product_{i} prime(q_i-i+1). These are the Heinz numbers of the rows of A125106. If the offset is changed to 0, the inverse is A156552. - Gus Wiseman, Dec 28 2022

Extensions

More terms from Robert G. Wilson v, Feb 22 2005
Sign in a formula switched and Maple program added by R. J. Mathar, Mar 06 2010
Binary tree illustration and keyword tabf added by Antti Karttunen, Dec 21 2014

A124010 Triangle in which first row is 0, n-th row (n>1) lists the exponents of distinct prime factors ("ordered prime signature") in the prime factorization of n.

Original entry on oeis.org

0, 1, 1, 2, 1, 1, 1, 1, 3, 2, 1, 1, 1, 2, 1, 1, 1, 1, 1, 1, 4, 1, 1, 2, 1, 2, 1, 1, 1, 1, 1, 1, 3, 1, 2, 1, 1, 3, 2, 1, 1, 1, 1, 1, 1, 5, 1, 1, 1, 1, 1, 1, 2, 2, 1, 1, 1, 1, 1, 3, 1, 1, 1, 1, 1, 1, 2, 1, 2, 1, 1, 1, 1, 4, 1, 2, 1, 2, 1, 1, 2, 1, 1, 1, 3, 1, 1, 3, 1, 1, 1, 1, 1, 1, 2, 1, 1, 1, 1, 1, 2, 1, 6, 1, 1, 1, 1, 1, 1, 2, 1, 1, 1, 1, 1, 1, 1, 3, 2, 1
Offset: 1

Views

Author

Keywords

Comments

A001222(n) = Sum(T(n,k), 1 <= k <= A001221(n)); A005361(n) = Product(T(n,k), 1 <= k <= A001221(n)), n>1; A051903(n) = Max(T(n,k): 1 <= k <= A001221(n)); A051904(n) = Min(T(n,k), 1 <= k <= A001221(n)); A067029(n) = T(n,1); A071178(n) = T(n,A001221(n)); A064372(n)=Sum(A064372(T(n,k)), 1 <= k <= A001221(n)). - Reinhard Zumkeller, Aug 27 2011
Any finite sequence of natural numbers appears as consecutive terms. - Paul Tek, Apr 27 2013
For n > 1: n-th row = n-th row of A067255 without zeros. - Reinhard Zumkeller, Jun 11 2013
Most often the prime signature is given as a sorted representative of the multiset of the nonzero exponents, either in increasing order, which yields A118914, or, most commonly, in decreasing order, which yields A212171. - M. F. Hasler, Oct 12 2018

Examples

			Initial values of exponents are:
1, [0]
2, [1]
3, [1]
4, [2]
5, [1]
6, [1, 1]
7, [1]
8, [3]
9, [2]
10, [1, 1]
11, [1]
12, [2, 1]
13, [1]
14, [1, 1]
15, [1, 1]
16, [4]
17, [1]
18, [1, 2]
19, [1]
20, [2, 1]
...
		

Crossrefs

Cf. A027748, A001221 (row lengths, n>1), A001222 (row sums), A027746, A020639, A064372, A067029 (first column).
Sorted rows: A118914, A212171.

Programs

  • Haskell
    a124010 n k = a124010_tabf !! (n-1) !! (k-1)
    a124010_row 1 = [0]
    a124010_row n = f n a000040_list where
       f 1 _      = []
       f u (p:ps) = h u 0 where
         h v e | m == 0 = h v' (e + 1)
               | m /= 0 = if e > 0 then e : f v ps else f v ps
               where (v',m) = divMod v p
    a124010_tabf = map a124010_row [1..]
    -- Reinhard Zumkeller, Jun 12 2013, Aug 27 2011
    
  • Maple
    expts:=proc(n) local t1,t2,t3,t4,i; if n=1 then RETURN([0]); fi; if isprime(n) then RETURN([1]); fi; t1:=ifactor(n); if nops(factorset(n))=1 then RETURN([op(2,t1)]); fi; t2:=nops(t1); t3:=[]; for i from 1 to t2 do t4:=op(i,t1); if nops(t4) = 1 then t3:=[op(t3),1]; else t3:=[op(t3),op(2,t4)]; fi; od; RETURN(t3); end; # N. J. A. Sloane, Dec 20 2007
    PrimeSignature := proc(n) local F, e, k; F := ifactors(n)[2]; [seq(e, e = seq(F[k][2], k = 1..nops(F)))] end:
    ListTools:-Flatten([[0], seq(PrimeSignature(n), n = 1..73)]); # Peter Luschny, Jun 15 2025
  • Mathematica
    row[1] = {0}; row[n_] := FactorInteger[n][[All, 2]] // Flatten; Table[row[n], {n, 1, 80}] // Flatten (* Jean-François Alcover, Aug 19 2013 *)
  • PARI
    print1(0); for(n=2,50, f=factor(n)[,2]; for(i=1,#f,print1(", "f[i]))) \\ Charles R Greathouse IV, Nov 07 2014
    
  • PARI
    A124010_row(n)=if(n,factor(n)[,2]~,[0]) \\ M. F. Hasler, Oct 12 2018
    
  • Python
    from sympy import factorint
    def a(n):
        f=factorint(n)
        return [0] if n==1 else [f[i] for i in f]
    for n in range(1, 21): print(a(n)) # Indranil Ghosh, May 16 2017

Formula

n = Product_k A027748(n,k)^a(n,k).

Extensions

Name edited by M. F. Hasler, Apr 08 2022

A066099 Triangle read by rows, in which row n lists the compositions of n in reverse lexicographic order.

Original entry on oeis.org

1, 2, 1, 1, 3, 2, 1, 1, 2, 1, 1, 1, 4, 3, 1, 2, 2, 2, 1, 1, 1, 3, 1, 2, 1, 1, 1, 2, 1, 1, 1, 1, 5, 4, 1, 3, 2, 3, 1, 1, 2, 3, 2, 2, 1, 2, 1, 2, 2, 1, 1, 1, 1, 4, 1, 3, 1, 1, 2, 2, 1, 2, 1, 1, 1, 1, 3, 1, 1, 2, 1, 1, 1, 1, 2, 1, 1, 1, 1, 1, 6, 5, 1, 4, 2, 4, 1, 1, 3, 3, 3, 2, 1, 3, 1, 2, 3, 1, 1, 1, 2, 4, 2, 3
Offset: 1

Views

Author

Alford Arnold, Dec 30 2001

Keywords

Comments

The representation of the compositions (for fixed n) is as lists of parts, the order between individual compositions (for the same n) is (list-)reversed lexicographic; see the example by Omar E. Pol. - Joerg Arndt, Sep 03 2013
This is the standard ordering for compositions in this database; it is similar to the Mathematica ordering for partitions (A080577). Other composition orderings include A124734 (similar to the Abramowitz & Stegun ordering for partitions, A036036), A108244 (similar to the Maple partition ordering, A080576), etc (see crossrefs).
Factorize each term in A057335; sequence records the values of the resulting exponents. It also runs through all possible permutations of multiset digits.
This can be regarded as a table in two ways: with each composition as a row, or with the compositions of each integer as a row. The first way has A000120 as row lengths and A070939 as row sums; the second has A001792 as row lengths and A001788 as row sums. - Franklin T. Adams-Watters, Nov 06 2006
This sequence includes every finite sequence of positive integers. - Franklin T. Adams-Watters, Nov 06 2006
Compositions (or ordered partitions) are also generated in sequence A101211. - Alford Arnold, Dec 12 2006
The equivalent sequence for partitions is A228531. - Omar E. Pol, Sep 03 2013
The sole partition of zero has no components, not a single component of length one. Hence the first nonempty row is row 1. - Franklin T. Adams-Watters, Apr 02 2014 [Edited by Andrey Zabolotskiy, May 19 2018]
See sequence A261300 for another version where the terms of each composition are concatenated to form one single integer: (0, 1, 2, 11, 3, 21, 12, 111,...). This also shows how the terms can be obtained from the binary numbers A007088, cf. Arnold's first Example. - M. F. Hasler, Aug 29 2015
The k-th composition in the list is obtained by taking the set of positions of 1's in the reversed binary expansion of k, prepending 0, taking first differences, and reversing again. This is described as the standard ordering used in the OEIS, although the sister sequence A228351 is also sometimes considered to be canonical. Both sequences define a bijective correspondence between nonnegative integers and integer compositions. - Gus Wiseman, May 19 2020
First differences of A030303 = positions of bits 1 in the concatenation A030190 (= A030302) of numbers written in binary (A007088). - Indices of record values (= first occurrence of n) are given by A005183: a(A005183(n)) = n, cf. FORMULA for more. - M. F. Hasler, Oct 12 2020
The geometric mean approaches the Somos constant (A112302). - Jwalin Bhatt, Feb 10 2025

Examples

			A057335 begins 1 2 4 6 8 12 18 30 16 24 36 ... so we can write
  1 2 1 3 2 1 1 4 3 2 2 1 1 1 1 ...
  . . 1 . 1 2 1 . 1 2 1 3 2 1 1 ...
  . . . . . . 1 . . . 1 . 1 2 1 ...
  . . . . . . . . . . . . . . 1 ...
and the columns here gives the rows of the triangle, which begins
  1
  2; 1 1
  3; 2 1; 1 2; 1 1 1
  4; 3 1; 2 2; 2 1 1; 1 3; 1 2 1; 1 1 2; 1 1 1 1
  ...
From _Omar E. Pol_, Sep 03 2013: (Start)
Illustration of initial terms:
  -----------------------------------
  n  j       Diagram   Composition j
  -----------------------------------
  .               _
  1  1           |_|   1;
  .             _ _
  2  1         |  _|   2,
  2  2         |_|_|   1, 1;
  .           _ _ _
  3  1       |    _|   3,
  3  2       |  _|_|   2, 1,
  3  3       | |  _|   1, 2,
  3  4       |_|_|_|   1, 1, 1;
  .         _ _ _ _
  4  1     |      _|   4,
  4  2     |    _|_|   3, 1,
  4  3     |   |  _|   2, 2,
  4  4     |  _|_|_|   2, 1, 1,
  4  5     | |    _|   1, 3,
  4  6     | |  _|_|   1, 2, 1,
  4  7     | | |  _|   1, 1, 2,
  4  8     |_|_|_|_|   1, 1, 1, 1;
(End)
		

Crossrefs

Lists of compositions of integers: this sequence (reverse lexicographic order; minus one gives A108730), A228351 (reverse colexicographic order - every composition is reversed; minus one gives A163510), A228369 (lexicographic), A228525 (colexicographic), A124734 (length, then lexicographic; minus one gives A124735), A296774 (length, then reverse lexicographic), A337243 (length, then colexicographic), A337259 (length, then reverse colexicographic), A296773 (decreasing length, then lexicographic), A296772 (decreasing length, then reverse lexicographic), A337260 (decreasing length, then colexicographic), A108244 (decreasing length, then reverse colexicographic), also A101211 and A227736 (run lengths of bits).
Cf. row length and row sums for different splittings into rows: A000120, A070939, A001792, A001788.
Cf. lists of partitions of integers, or multisets of integers: A026791 and crosserfs therein, A112798 and crossrefs therein.
See link for additional crossrefs pertaining to standard compositions.
A related ranking of finite sets is A048793/A272020.

Programs

  • Haskell
    a066099 = (!!) a066099_list
    a066099_list = concat a066099_tabf
    a066099_tabf = map a066099_row [1..]
    a066099_row n = reverse $ a228351_row n
    -- (each composition as a row)
    -- Peter Kagey, Aug 25 2016
    
  • Mathematica
    Table[FactorInteger[Apply[Times, Map[Prime, Accumulate @ IntegerDigits[n, 2]]]][[All, -1]], {n, 41}] // Flatten (* Michael De Vlieger, Jul 11 2017 *)
    stc[n_] := Differences[Prepend[Join @@ Position[Reverse[IntegerDigits[n, 2]], 1], 0]] // Reverse;
    Table[stc[n], {n, 0, 20}] // Flatten (* Gus Wiseman, May 19 2020 *)
    Table[Reverse @ LexicographicSort @ Flatten[Permutations /@ Partitions[n], 1], {n, 10}] // Flatten (* Eric W. Weisstein, Jun 26 2023 *)
  • PARI
    arow(n) = {local(v=vector(n),j=0,k=0);
       while(n>0,k++; if(n%2==1,v[j++]=k;k=0);n\=2);
       vector(j,i,v[j-i+1])} \\ returns empty for n=0. - Franklin T. Adams-Watters, Apr 02 2014
    
  • Python
    from itertools import islice
    from itertools import accumulate, count, groupby, islice
    def A066099_gen():
        for i in count(1):
            yield [len(list(g)) for _,g in groupby(accumulate(int(b) for b in bin(i)[2:]))]
    A066099 = list(islice(A066099_gen(), 120))  # Jwalin Bhatt, Feb 28 2025
  • Sage
    def a_row(n): return list(reversed(Compositions(n)))
    flatten([a_row(n) for n in range(1,6)]) # Peter Luschny, May 19 2018
    

Formula

From M. F. Hasler, Oct 12 2020: (Start)
a(n) = A030303(n+1) - A030303(n).
a(A005183(n)) = n; a(A005183(n)+1) = n-1 (n>1); a(A005183(n)+2) = 1. (End)

Extensions

Edited with additional terms by Franklin T. Adams-Watters, Nov 06 2006
0th row removed by Andrey Zabolotskiy, May 19 2018

A048793 List giving all subsets of natural numbers arranged in standard statistical (or Yates) order.

Original entry on oeis.org

0, 1, 2, 1, 2, 3, 1, 3, 2, 3, 1, 2, 3, 4, 1, 4, 2, 4, 1, 2, 4, 3, 4, 1, 3, 4, 2, 3, 4, 1, 2, 3, 4, 5, 1, 5, 2, 5, 1, 2, 5, 3, 5, 1, 3, 5, 2, 3, 5, 1, 2, 3, 5, 4, 5, 1, 4, 5, 2, 4, 5, 1, 2, 4, 5, 3, 4, 5, 1, 3, 4, 5, 2, 3, 4, 5, 1, 2, 3, 4, 5, 6, 1, 6, 2, 6, 1, 2, 6, 3, 6, 1, 3, 6, 2, 3, 6, 1, 2, 3, 6, 4, 6, 1, 4
Offset: 0

Views

Author

Keywords

Comments

For n>0: first occurrence of n in row 2^(n-1), and when the table is seen as a flattened list at position n*2^(n-1)+1, cf. A005183. - Reinhard Zumkeller, Nov 16 2013
Row n lists the positions of 1's in the reversed binary expansion of n. Compare to triangles A112798 and A213925. - Gus Wiseman, Jul 22 2019

Examples

			From _Gus Wiseman_, Jul 22 2019: (Start)
Triangle begins:
  {}
  1
  2
  1  2
  3
  1  3
  2  3
  1  2  3
  4
  1  4
  2  4
  1  2  4
  3  4
  1  3  4
  2  3  4
  1  2  3  4
  5
  1  5
  2  5
  1  2  5
  3  5
(End)
		

References

  • S. Hedayat, N. J. A. Sloane and J. Stufken, Orthogonal Arrays, Springer-Verlag, NY, 1999, p. 249.

Crossrefs

Cf. A048794.
Row lengths are A000120.
First column is A001511.
Heinz numbers of rows are A019565.
Row sums are A029931.
Reversing rows gives A272020.
Subtracting 1 from each term gives A133457; subtracting 1 and reversing rows gives A272011.
Indices of relatively prime rows are A291166 (see also A326674); arithmetic progressions are A295235; rows with integer average are A326669 (see also A326699/A326700); pairwise coprime rows are A326675.

Programs

  • C
    #include 
    #include 
    #define USAGE "Usage: 'A048793 num' where num is the largest number to use creating sets.\n"
    #define MAX_NUM 10
    #define MAX_ROW 1024
    int main(int argc, char *argv[]) {
      unsigned short a[MAX_ROW][MAX_NUM]; signed short old_row, new_row, i, j, end;
      if (argc < 2) { fprintf(stderr, USAGE); return EXIT_FAILURE; }
      end = atoi(argv[1]); end = (end > MAX_NUM) ? MAX_NUM: end;
      for (i = 0; i < MAX_ROW; i++) for ( j = 0; j < MAX_NUM; j++) a[i][j] = 0;
      a[1][0] = 1; new_row = 2;
      for (i = 2; i <= end; i++) {
        a[new_row++ ][0] = i;
        for (old_row = 1; a[old_row][0] != i; old_row++) {
          for (j = 0; a[old_row][j] != 0; j++) { a[new_row][j] = a[old_row][j]; }
          a[new_row++ ][j] = i;
        }
      }
      fprintf(stdout, "Values: 0");
      for (i = 1; a[i][0] != 0; i++) for (j = 0; a[i][j] != 0; j++) fprintf(stdout, ",%d", a[i][j]);
      fprintf(stdout, "\n"); return EXIT_SUCCESS
    }
    
  • Haskell
    a048793 n k = a048793_tabf !! n !! k
    a048793_row n = a048793_tabf !! n
    a048793_tabf = [0] : [1] : f [[1]] where
       f xss = yss ++ f (xss ++ yss) where
         yss = [y] : map (++ [y]) xss
         y = last (last xss) + 1
    -- Reinhard Zumkeller, Nov 16 2013
  • Maple
    T:= proc(n) local i, l, m; l:= NULL; m:= n;
          if n=0 then return 0 fi; for i while m>0 do
          if irem(m, 2, 'm')=1 then l:=l, i fi od; l
        end:
    seq(T(n), n=0..50);  # Alois P. Heinz, Sep 06 2014
  • Mathematica
    s[0] = {{}}; s[n_] := s[n] = Join[s[n - 1], Append[#, n]& /@ s[n - 1]]; Join[{0}, Flatten[s[6]]] (* Jean-François Alcover, May 24 2012 *)
    Table[Join@@Position[Reverse[IntegerDigits[n,2]],1],{n,30}] (* Gus Wiseman, Jul 22 2019 *)

Formula

Constructed recursively: subsets that include n are obtained by appending n to all earlier subsets.

Extensions

More terms from Larry Reeves (larryr(AT)acm.org), Apr 11 2000

A296150 Triangle whose n-th row is the integer partition with Heinz number n.

Original entry on oeis.org

1, 2, 1, 1, 3, 2, 1, 4, 1, 1, 1, 2, 2, 3, 1, 5, 2, 1, 1, 6, 4, 1, 3, 2, 1, 1, 1, 1, 7, 2, 2, 1, 8, 3, 1, 1, 4, 2, 5, 1, 9, 2, 1, 1, 1, 3, 3, 6, 1, 2, 2, 2, 4, 1, 1, 10, 3, 2, 1, 11, 1, 1, 1, 1, 1, 5, 2, 7, 1, 4, 3, 2, 2, 1, 1, 12, 8, 1, 6, 2, 3, 1, 1, 1, 13, 4
Offset: 1

Views

Author

Gus Wiseman, Feb 05 2018

Keywords

Comments

Same as A112798 with rows reversed. Row lengths are A001222. Rows sums are A056239.
The Heinz number of an integer partition (y_1,...,y_k) is prime(y_1)*...*prime(y_k).

Examples

			Sequence of partitions begins: (), (1), (2), (11), (3), (21), (4), (111), (22), (31), (5), (211), (6), (41), (32), (1111), (7), (221).
		

Crossrefs

Programs

  • Maple
    f := n -> op(map(numtheory:-pi, sort(map(`$`@op, ifactors(n)[2]), `>`))):
    map(f, [$1..100]); # Robert Israel, Feb 09 2018
  • Mathematica
    Table[If[n===1,{},Join@@Cases[FactorInteger[n]//Reverse,{p_,k_}:>Table[PrimePi[p],{k}]]],{n,50}]

A019565 The squarefree numbers ordered lexicographically by their prime factorization (with factors written in decreasing order). a(n) = Product_{k in I} prime(k+1), where I is the set of indices of nonzero binary digits in n = Sum_{k in I} 2^k.

Original entry on oeis.org

1, 2, 3, 6, 5, 10, 15, 30, 7, 14, 21, 42, 35, 70, 105, 210, 11, 22, 33, 66, 55, 110, 165, 330, 77, 154, 231, 462, 385, 770, 1155, 2310, 13, 26, 39, 78, 65, 130, 195, 390, 91, 182, 273, 546, 455, 910, 1365, 2730, 143, 286, 429, 858, 715, 1430, 2145, 4290
Offset: 0

Views

Author

Keywords

Comments

A permutation of the squarefree numbers A005117. The missing positive numbers are in A013929. - Alois P. Heinz, Sep 06 2014
From Antti Karttunen, Apr 18 & 19 2017: (Start)
Because a(n) toggles the parity of n there are neither fixed points nor any cycles of odd length.
Conjecture: there are no finite cycles of any length. My grounds for this conjecture: any finite cycle in this sequence, if such cycles exist at all, must have at least one member that occurs somewhere in A285319, the terms that seem already to be quite rare. Moreover, any such a number n should satisfy in addition to A019565(n) < n also that A048675^{k}(n) is squarefree, not just for k=0, 1 but for all k >= 0. As there is on average a probability of only 6/(Pi^2) = 0.6079... that any further term encountered on the trajectory of A048675 is squarefree, the total chance that all of them would be squarefree (which is required from the elements of A019565-cycles) is soon minuscule, especially as A048675 is not very tightly bounded (many trajectories seem to skyrocket, at least initially). I am also assuming that usually there is no significant correlation between the binary expansions of n and A048675(n) (apart from their least significant bits), or, for that matter, between their prime factorizations.
See also the slightly stronger conjecture in A285320, which implies that there would neither be any two-way infinite cycles.
If either of the conjectures is false (there are cycles), then certainly neither sequence A285332 nor its inverse A285331 can be a permutation of natural numbers. (End)
The conjecture made in A087207 (see also A288569) implies the two conjectures mentioned above. A further constraint for cycles is that in any A019565-trajectory which starts from a squarefree number (A005117), every other term is of the form 4k+2, while every other term is of the form 6k+3. - Antti Karttunen, Jun 18 2017
The sequence satisfies the exponential function identity, a(x + y) = a(x) * a(y), whenever x and y do not have a 1-bit in the same position, i.e., when A004198(x,y) = 0. See also A283475. - Antti Karttunen, Oct 31 2019
The above identity becomes unconditional if binary exclusive OR, A003987(.,.), is substituted for addition, and A059897(.,.), a multiplicative equivalent of A003987, is substituted for multiplication. This gives us a(A003987(x,y)) = A059897(a(x), a(y)). - Peter Munn, Nov 18 2019
Also the Heinz number of the binary indices of n, where the Heinz number of a sequence (y_1,...,y_k) is prime(y_1)*...*prime(y_k), and a number's binary indices (A048793) are the positions of 1's in its reversed binary expansion. - Gus Wiseman, Dec 28 2022

Examples

			5 = 2^2+2^0, e_1 = 2, e_2 = 0, prime(2+1) = prime(3) = 5, prime(0+1) = prime(1) = 2, so a(5) = 5*2 = 10.
From _Philippe Deléham_, Jun 03 2015: (Start)
This sequence regarded as a triangle withs rows of lengths 1, 1, 2, 4, 8, 16, ...:
   1;
   2;
   3,  6;
   5, 10, 15, 30;
   7, 14, 21, 42, 35,  70, 105, 210;
  11, 22, 33, 66, 55, 110, 165, 330, 77, 154, 231, 462, 385, 770, 1155, 2310;
  ...
(End)
From _Peter Munn_, Jun 14 2020: (Start)
The initial terms are shown below, equated with the product of their prime factors to exhibit the lexicographic order. We start with 1, since 1 is factored as the empty product and the empty list is first in lexicographic order.
   n     a(n)
   0     1 = .
   1     2 = 2.
   2     3 = 3.
   3     6 = 3*2.
   4     5 = 5.
   5    10 = 5*2.
   6    15 = 5*3.
   7    30 = 5*3*2.
   8     7 = 7.
   9    14 = 7*2.
  10    21 = 7*3.
  11    42 = 7*3*2.
  12    35 = 7*5.
(End)
		

Crossrefs

Row 1 of A285321.
Equivalent sequences for k-th-power-free numbers: A101278 (k=3), A101942 (k=4), A101943 (k=5), A054842 (k=10).
Cf. A109162 (iterates).
Cf. also A048675 (a left inverse), A087207, A097248, A260443, A054841.
Cf. A285315 (numbers for which a(n) < n), A285316 (for which a(n) > n).
Cf. A276076, A276086 (analogous sequences for factorial and primorial bases), A334110 (terms squared).
For partial sums see A288570.
A003961, A003987, A004198, A059897, A089913, A331590, A334747 are used to express relationships between sequence terms.
Column 1 of A329332.
Even bisection (which contains the odd terms): A332382.
A160102 composed with A052330, and subsequence of the latter.
Related to A000079 via A225546, to A057335 via A122111, to A008578 via A336322.
Least prime index of a(n) is A001511.
Greatest prime index of a(n) is A029837 or A070939.
Taking prime indices gives A048793, reverse A272020, row sums A029931.
A112798 lists prime indices, length A001222, sum A056239.

Programs

  • Haskell
    a019565 n = product $ zipWith (^) a000040_list (a030308_row n)
    -- Reinhard Zumkeller, Apr 27 2013
    
  • Maple
    a:= proc(n) local i, m, r; m:=n; r:=1;
          for i while m>0 do if irem(m,2,'m')=1
            then r:=r*ithprime(i) fi od; r
        end:
    seq(a(n), n=0..60);  # Alois P. Heinz, Sep 06 2014
  • Mathematica
    Do[m=1;o=1;k1=k;While[ k1>0, k2=Mod[k1, 2];If[k2\[Equal]1, m=m*Prime[o]];k1=(k1-k2)/ 2;o=o+1];Print[m], {k, 0, 55}] (* Lei Zhou, Feb 15 2005 *)
    Table[Times @@ Prime@ Flatten@ Position[#, 1] &@ Reverse@ IntegerDigits[n, 2], {n, 0, 55}]  (* Michael De Vlieger, Aug 27 2016 *)
    b[0] := {1}; b[n_] := Flatten[{ b[n - 1], b[n - 1] * Prime[n] }];
      a = b[6] (* Fred Daniel Kline, Jun 26 2017 *)
  • PARI
    a(n)=factorback(vecextract(primes(logint(n+!n,2)+1),n))  \\ M. F. Hasler, Mar 26 2011, updated Aug 22 2014, updated Mar 01 2018
    
  • Python
    from operator import mul
    from functools import reduce
    from sympy import prime
    def A019565(n):
        return reduce(mul,(prime(i+1) for i,v in enumerate(bin(n)[:1:-1]) if v == '1')) if n > 0 else 1
    # Chai Wah Wu, Dec 25 2014
    
  • Scheme
    (define (A019565 n) (let loop ((n n) (i 1) (p 1)) (cond ((zero? n) p) ((odd? n) (loop (/ (- n 1) 2) (+ 1 i) (* p (A000040 i)))) (else (loop (/ n 2) (+ 1 i) p))))) ;; (Requires only the implementation of A000040 for prime numbers.) - Antti Karttunen, Apr 20 2017

Formula

G.f.: Product_{k>=0} (1 + prime(k+1)*x^2^k), where prime(k)=A000040(k). - Ralf Stephan, Jun 20 2003
a(n) = f(n, 1, 1) with f(x, y, z) = if x > 0 then f(floor(x/2), y*prime(z)^(x mod 2), z+1) else y. - Reinhard Zumkeller, Mar 13 2010
For all n >= 0: A048675(a(n)) = n; A013928(a(n)) = A064273(n). - Antti Karttunen, Jul 29 2015
a(n) = a(2^x)*a(2^y)*a(2^z)*... = prime(x+1)*prime(y+1)*prime(z+1)*..., where n = 2^x + 2^y + 2^z + ... - Benedict W. J. Irwin, Jul 24 2016
From Antti Karttunen, Apr 18 2017 and Jun 18 2017: (Start)
a(n) = A097248(A260443(n)), a(A005187(n)) = A283475(n), A108951(a(n)) = A283477(n).
A055396(a(n)) = A001511(n), a(A087207(n)) = A007947(n). (End)
a(2^n - 1) = A002110(n). - Michael De Vlieger, Jul 05 2017
a(n) = A225546(A000079(n)). - Peter Munn, Oct 31 2019
From Peter Munn, Mar 04 2022: (Start)
a(2n) = A003961(a(n)); a(2n+1) = 2*a(2n).
a(x XOR y) = A059897(a(x), a(y)) = A089913(a(x), a(y)), where XOR denotes bitwise exclusive OR (A003987).
a(n+1) = A334747(a(n)).
a(x+y) = A331590(a(x), a(y)).
a(n) = A336322(A008578(n+1)).
(End)

Extensions

Definition corrected by Klaus-R. Löffler, Aug 20 2014
New name from Peter Munn, Jun 14 2020

A029931 If 2n = Sum 2^e_i, a(n) = Sum e_i.

Original entry on oeis.org

0, 1, 2, 3, 3, 4, 5, 6, 4, 5, 6, 7, 7, 8, 9, 10, 5, 6, 7, 8, 8, 9, 10, 11, 9, 10, 11, 12, 12, 13, 14, 15, 6, 7, 8, 9, 9, 10, 11, 12, 10, 11, 12, 13, 13, 14, 15, 16, 11, 12, 13, 14, 14, 15, 16, 17, 15, 16, 17, 18, 18, 19, 20, 21, 7, 8, 9, 10, 10, 11, 12, 13, 11, 12, 13, 14, 14, 15, 16
Offset: 0

Views

Author

Keywords

Comments

Write n in base 2, n = sum b(i)*2^(i-1), then a(n) = sum b(i)*i. - Benoit Cloitre, Jun 09 2002
May be regarded as a triangular array read by rows, giving weighted sum of compositions in standard order. The standard order of compositions is given by A066099. - Franklin T. Adams-Watters, Nov 06 2006
Sum of all positive integer roots m_i of polynomial {m,k} - see link [Shevelev]; see also A264613. - Vladimir Shevelev, Dec 13 2015
Also the sum of binary indices of n, where a binary index of n (A048793) is any position of a 1 in its reversed binary expansion. For example, the binary indices of 11 are {1,2,4}, so a(11) = 7. - Gus Wiseman, May 22 2024

Examples

			14 = 8+4+2 so a(7) = 3+2+1 = 6.
Composition number 11 is 2,1,1; 1*2+2*1+3*1 = 7, so a(11) = 7.
The triangle starts:
  0
  1
  2 3
  3 4 5 6
The reversed binary expansion of 18 is (0,1,0,0,1) with 1's at positions {2,5}, so a(18) = 2 + 5 = 7. - _Gus Wiseman_, Jul 22 2019
		

Crossrefs

Other sequences that are built by replacing 2^k in the binary representation with other numbers: A022290 (Fibonacci), A059590 (factorials), A073642, A089625 (primes), A116549, A326031.
Cf. A001793 (row sums), A011782 (row lengths), A059867, A066099, A124757.
Row sums of A048793 and A272020.
Contains exactly A000009(n) copies of n.
For length instead of sum we have A000120, complement A023416.
For minimum instead of sum we have A001511, opposite A000012.
For maximum instead of sum we have A029837 or A070939, opposite A070940.
For product instead of sum we have A096111.
The reverse version is A230877, row sums of A371572.
The reverse complement is A359359, row sums of A371571.
The complement is A359400, row sums of A368494.
Numbers k such that a(k) is prime are A372689.
A014499 lists binary indices of prime numbers.
A019565 gives Heinz number of binary indices, inverse A048675.
A372471 lists binary indices of primes, row-sums A372429.

Programs

  • Haskell
    a029931 = sum . zipWith (*) [1..] . a030308_row
    -- Reinhard Zumkeller, Feb 28 2014
    
  • Maple
    HammingWeight := n -> add(i, i = convert(n, base, 2)):
    a := proc(n) option remember; `if`(n = 0, 0,
    ifelse(n::even, a(n/2) + HammingWeight(n/2), a(n-1) + 1)) end:
    seq(a(n), n = 0..78); # Peter Luschny, Oct 30 2021
  • Mathematica
    a[n_] := (b = IntegerDigits[n, 2]).Reverse @ Range[Length @ b]; Array[a,78,0] (* Jean-François Alcover, Apr 28 2011, after B. Cloitre *)
  • PARI
    for(n=0,100,l=length(binary(n)); print1(sum(i=1,l, component(binary(n),i)*(l-i+1)),","))
    
  • PARI
    a(n) = my(b=binary(n)); b*-[-#b..-1]~; \\ Ruud H.G. van Tol, Oct 17 2023
    
  • Python
    def A029931(n): return sum(i if j == '1' else 0 for i, j in enumerate(bin(n)[:1:-1],1)) # Chai Wah Wu, Dec 20 2022
    (C#)
    ulong A029931(ulong n) {
        ulong result = 0, counter = 1;
        while(n > 0) {
            if (n % 2 == 1)
              result += counter;
            counter++;
            n /= 2;
        }
        return result;
    } // Frank Hollstein, Jan 07 2023

Formula

a(n) = a(n - 2^L(n)) + L(n) + 1 [where L(n) = floor(log_2(n)) = A000523(n)] = sum of digits of A048794 [at least for n < 512]. - Henry Bottomley, Mar 09 2001
a(0) = 0, a(2n) = a(n) + e1(n), a(2n+1) = a(2n) + 1, where e1(n) = A000120(n). a(n) = log_2(A029930(n)). - Ralf Stephan, Jun 19 2003
G.f.: (1/(1-x)) * Sum_{k>=0} (k+1)*x^2^k/(1+x^2^k). - Ralf Stephan, Jun 23 2003
a(n) = Sum_{k>=0} A030308(n,k)*A000027(k+1). - Philippe Deléham, Oct 15 2011
a(n) = sum of n-th row of the triangle in A213629. - Reinhard Zumkeller, Jun 17 2012
From Reinhard Zumkeller, Feb 28 2014: (Start)
a(A089633(n)) = n and a(m) != n for m < A089633(n).
a(n) = Sum_{k=1..A070939(n)} k*A030308(n,k-1). (End)
a(n) = A073642(n) + A000120(n). - Peter Kagey, Apr 04 2016

Extensions

More terms from Erich Friedman
Showing 1-10 of 8005 results. Next