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-8 of 8 results.

A051026 Number of primitive subsequences of {1, 2, ..., n}.

Original entry on oeis.org

1, 2, 3, 5, 7, 13, 17, 33, 45, 73, 103, 205, 253, 505, 733, 1133, 1529, 3057, 3897, 7793, 10241, 16513, 24593, 49185, 59265, 109297, 163369, 262489, 355729, 711457, 879937, 1759873, 2360641, 3908545, 5858113, 10534337, 12701537, 25403073, 38090337, 63299265, 81044097, 162088193, 205482593, 410965185, 570487233, 855676353
Offset: 0

Views

Author

Keywords

Comments

a(n) counts all subsequences of {1, ..., n} in which no term divides any other. If n is a prime a(n) = 2*a(n-1)-1 because for each subsequence s counted by a(n-1) two different subsequences are counted by a(n): s and s,n. There is only one exception: 1,n is not a primitive subsequence because 1 divides n. For all n>1: a(n) < 2*a(n-1). - Alois P. Heinz, Mar 07 2011
Maximal primitive subsets are counted by A326077. - Gus Wiseman, Jun 07 2019

Examples

			a(4) = 7, the primitive subsequences (including the empty sequence) are: (), (1), (2), (3), (4), (2,3), (3,4).
a(5) = 13 = 2*7-1, the primitive subsequences are: (), (5), (1), (2), (2,5), (3), (3,5), (4), (4,5), (2,3), (2,3,5), (3,4), (3,4,5).
From _Gus Wiseman_, Jun 07 2019: (Start)
The a(0) = 1 through a(5) = 13 primitive (pairwise indivisible) subsets:
  {}  {}   {}   {}     {}     {}
      {1}  {1}  {1}    {1}    {1}
           {2}  {2}    {2}    {2}
                {3}    {3}    {3}
                {2,3}  {4}    {4}
                       {2,3}  {5}
                       {3,4}  {2,3}
                              {2,5}
                              {3,4}
                              {3,5}
                              {4,5}
                              {2,3,5}
                              {3,4,5}
a(n) is also the number of subsets of {1..n} containing all of their pairwise products <= n as well as any quotients of divisible elements. For example, the a(0) = 1 through a(5) = 13 subsets are:
  {}  {}   {}     {}       {}         {}
      {1}  {1}    {1}      {1}        {1}
           {1,2}  {1,2}    {1,3}      {1,3}
                  {1,3}    {1,4}      {1,4}
                  {1,2,3}  {1,2,4}    {1,5}
                           {1,3,4}    {1,2,4}
                           {1,2,3,4}  {1,3,4}
                                      {1,3,5}
                                      {1,4,5}
                                      {1,2,3,4}
                                      {1,2,4,5}
                                      {1,3,4,5}
                                      {1,2,3,4,5}
Also the number of subsets of {1..n} containing all of their multiples <= n. For example, the a(0) = 1 through a(5) = 13 subsets are:
  {}  {}   {}     {}       {}         {}
      {1}  {2}    {2}      {3}        {3}
           {1,2}  {3}      {4}        {4}
                  {2,3}    {2,4}      {5}
                  {1,2,3}  {3,4}      {2,4}
                           {2,3,4}    {3,4}
                           {1,2,3,4}  {3,5}
                                      {4,5}
                                      {2,3,4}
                                      {2,4,5}
                                      {3,4,5}
                                      {2,3,4,5}
                                      {1,2,3,4,5}
(End)
From _Gus Wiseman_, Mar 12 2024: (Start)
Also the number of subsets of {1..n} containing all divisors of the elements. For example, the a(0) = 1 through a(6) = 17 subsets are:
  {}  {}   {}     {}       {}         {}
      {1}  {1}    {1}      {1}        {1}
           {1,2}  {1,2}    {1,2}      {1,2}
                  {1,3}    {1,3}      {1,3}
                  {1,2,3}  {1,2,3}    {1,5}
                           {1,2,4}    {1,2,3}
                           {1,2,3,4}  {1,2,4}
                                      {1,2,5}
                                      {1,3,5}
                                      {1,2,3,4}
                                      {1,2,3,5}
                                      {1,2,4,5}
                                      {1,2,3,4,5}
(End)
		

References

  • Blanchet-Sadri, Francine. Algorithmic combinatorics on partial words. Chapman & Hall/CRC, Boca Raton, FL, 2008. ii+385 pp. ISBN: 978-1-4200-6092-8; 1-4200-6092-9 MR2384993 (2009f:68142). See p. 320. - N. J. A. Sloane, Apr 06 2012

Crossrefs

Programs

  • Maple
    with(numtheory):
    b:= proc(s) option remember; local n;
          n:= max(s[]);
          `if`(n<0, 1, b(s minus {n}) + b(s minus divisors(n)))
        end:
    bb:= n-> b({$2..n} minus divisors(n)):
    sb:= proc(n) option remember; `if`(n<2, 0, bb(n) + sb(n-1)) end:
    a:= n-> `if`(n=0, 1, `if`(isprime(n), 2*a(n-1)-1, 2+sb(n))):
    seq(a(n), n=0..40);  # Alois P. Heinz, Mar 07 2011
  • Mathematica
    b[s_] := b[s] = With[{n=Max[s]}, If[n < 0, 1, b[Complement[s, {n}]] + b[Complement[s, Divisors[n]]]]];
    bb[n_] := b[Complement[Range[2, n], Divisors[n]]];
    sb[n_] := sb[n] = If[n < 2, 0, bb[n] + sb[n-1]];
    a[n_] := If[n == 0, 1, If[PrimeQ[n], 2a[n-1] - 1, 2 + sb[n]]]; Table[a[n], {n, 0, 37}]
    (* Jean-François Alcover, Jul 27 2011, converted from Maple *)
    Table[Length[Select[Subsets[Range[n]], SubsetQ[#,Select[Union@@Table[#*i,{i,n}],#<=n&]]&]],{n,10}] (* Gus Wiseman, Jun 07 2019 *)
    Table[Length[Select[Subsets[Range[n]], #==Union@@Divisors/@#&]],{n,0,10}] (* Gus Wiseman, Mar 12 2024 *)

Extensions

More terms from David Wasserman, May 02 2002
a(32)-a(37) from Donovan Johnson, Aug 11 2010

A357812 Number of subsets of [n] in which exactly half of the elements are powers of 2.

Original entry on oeis.org

1, 1, 1, 3, 4, 10, 20, 35, 70, 126, 210, 330, 495, 715, 1001, 1365, 4368, 6188, 8568, 11628, 15504, 20349, 26334, 33649, 42504, 53130, 65780, 80730, 98280, 118755, 142506, 169911, 906192, 1107568, 1344904, 1623160, 1947792, 2324784, 2760681, 3262623, 3838380
Offset: 0

Views

Author

Alois P. Heinz, Oct 13 2022

Keywords

Examples

			a(6) = 20: {}, {1,3}, {1,5}, {1,6}, {2,3}, {2,5}, {2,6}, {3,4}, {4,5}, {4,6}, {1,2,3,5}, {1,2,3,6}, {1,2,5,6}, {1,3,4,5}, {1,3,4,6}, {1,4,5,6}, {2,3,4,5}, {2,3,4,6}, {2,4,5,6}, {1,2,3,4,5,6}.
		

Crossrefs

Programs

  • Maple
    a:= n-> binomial(n, max(0, 1+ilog[2](n))):
    seq(a(n), n=0..40);
  • Python
    from math import comb
    def A357812(n): return comb(n,n.bit_length()) # Chai Wah Wu, Oct 14 2022

Formula

a(n) = binomial(n,A029837(n+1)).
a(n) = binomial(n,A113473(n)) for n>0, a(0) = 1.
a(n) = Sum_{j>=0} binomial(A029837(n+1),j)*binomial(n-A029837(n+1),j).

A369780 a(n) = number of subsets of {1,2,...,n} that contain more primes than nonprimes.

Original entry on oeis.org

0, 0, 1, 4, 5, 16, 22, 64, 93, 130, 176, 562, 794, 2380, 3473, 4944, 6885, 21778, 31180, 94184, 137980, 198440, 280600, 880970, 1271626, 1807781, 2533987, 3505699, 4791323, 16489546, 22964087, 75973189, 107594213, 150676186, 208791332, 286454524, 389329652
Offset: 0

Views

Author

Clark Kimberling, Feb 03 2024

Keywords

Examples

			a(4) = 5 enumerates these subsets: {2}, {3}, {2,3}, {1,2,3}, {2,3,4}.
		

Crossrefs

Programs

  • Maple
    b:= proc(n, t) option remember; `if`(n=0, `if`(t>0, 1, 0),
          b(n-1, t)+b(n-1, t+`if`(isprime(n), 1, -1)))
        end:
    a:= n-> b(n, 0):
    seq(a(n), n=0..36);  # Alois P. Heinz, Feb 03 2024
  • Mathematica
    Map[Length[Select[Map[Commonest, PrimeQ[Rest[Subsets[Range[#]]]]], # == {True} &]] &, Range[22]]  (* Peter J. C. Moses, Jan 29 2024 *)

Formula

a(n) + A369781(n) = 2^n-1.
a(n) = Sum_{i=1..pi(n)} Sum_{j=0..i-1} binomial(pi(n),i)*binomial(n-pi(n),j). - Alois P. Heinz, Feb 03 2024

Extensions

a(23)-a(36) from Alois P. Heinz, Feb 03 2024

A369781 a(n) = number of nonempty subsets S of {1,2,...,n} such that (number of primes in S) <= (number of nonprimes in S).

Original entry on oeis.org

0, 1, 2, 3, 10, 15, 41, 63, 162, 381, 847, 1485, 3301, 5811, 12910, 27823, 58650, 109293, 230963, 430103, 910595, 1898711, 3913703, 7507637, 15505589, 31746650, 64574876, 130712028, 263644132, 520381365, 1050777736, 2071510458, 4187373082, 8439258405, 16971077851
Offset: 0

Views

Author

Clark Kimberling, Feb 03 2024

Keywords

Examples

			a(4) = 10 enumerates these subsets: {1}, {4}, {1,2}, {1,3}, {1,4}, {2,4}, {3,4}, {1,3,4}, {1,2,4}, {1,2,3,4}.
		

Crossrefs

Programs

  • Mathematica
    Map[Length[Select[Map[Commonest, PrimeQ[Rest[Subsets[Range[#]]]]], # != {True} &]] &, Range[22]] (* Peter J. C. Moses, Jan 29 2024 *)

Formula

a(n) + A369780(n) = 2^n-1 = A369853(n) + A369854(n).

Extensions

a(23)-a(34) from Alois P. Heinz, Feb 03 2024

A369854 a(n) = number of nonempty subsets S of {1,2,...,n} such that (number of nonprimes in S) = (number of primes in S).

Original entry on oeis.org

0, 0, 1, 2, 5, 9, 19, 34, 69, 125, 209, 461, 791, 1715, 3002, 5004, 8007, 19447, 31823, 75581, 125969, 203489, 319769, 817189, 1307503, 2042974, 3124549, 4686824, 6906899, 20030009, 30045014, 84672314, 129024479, 193536719, 286097759, 417225899, 600805295
Offset: 0

Views

Author

Clark Kimberling, Feb 03 2024

Keywords

Examples

			a(5) = 9 counts these subsets: {1,2}, {1,3}, {1,5}, {2,4}, {3,4}, {4,5}, {1,2,3,4}, {1,2,4,5}, {1,3,4,5}.
		

Crossrefs

Programs

  • Maple
    a:= n-> binomial(n, numtheory[pi](n))-1:
    seq(a(n), n=0..36);  # Alois P. Heinz, Feb 03 2024
  • Mathematica
    Map[Length[Select[Map[Commonest, PrimeQ[Rest[Subsets[Range[#]]]]], # == {False, True} || # == {True, False} &]] &, Range[22]]  (* Peter J. C. Moses, Jan 29 2024 *)

Formula

a(n) = A369781(n) - A369853(n).
a(n) = A037031(n) - 1 = binomial(n,pi(n)) - 1. - Alois P. Heinz, Feb 03 2024

Extensions

a(23)-a(36) from Alois P. Heinz, Feb 03 2024

A377537 a(n) is the number of positive integers that have n prime factors and these are all <= n.

Original entry on oeis.org

0, 1, 4, 5, 21, 28, 120, 165, 220, 286, 1365, 1820, 8568, 11628, 15504, 20349, 100947, 134596, 657800, 888030, 1184040, 1560780, 7888725, 10518300, 13884156, 18156204, 23535820, 30260340, 163011640, 211915132, 1121099408, 1471442973, 1917334783, 2481256778, 3190187286
Offset: 1

Views

Author

Felix Huber, Nov 04 2024

Keywords

Examples

			a(2) = 1 because 1 positive integer has 2 prime factors <= 2: 4 = 2*2.
a(3) = 4 because 4 positive integers have 3 prime factors <= 3: 8 = 2*2*2, 12 = 2*2*3, 18 = 2*3*3, 27 = 3*3*3.
a(4) = 5 because 5 positive integers have 4 prime factors <= 4: 16 = 2*2*2*2, 24 = 2*2*2*3, 36 = 2*2*3*3, 54 = 2*3*3*3, 81 = 3*3*3*3.
		

Crossrefs

Programs

  • Maple
    A377537:=n->binomial(NumberTheory:-pi(n)+n-1,n);seq(A377537(n),n=1..35);
  • Mathematica
    a[n_]:= Binomial[PrimePi[n] + n - 1, n]; Array[a,35] (* Stefano Spezia, Nov 04 2024 *)
  • PARI
    a(n) = binomial(primepi(n) + n - 1, n); \\ Michel Marcus, Nov 05 2024
    
  • Python
    from math import comb
    from sympy import primepi
    def A377537(n): return comb(primepi(n)+n-1,n) # Chai Wah Wu, Nov 12 2024

Formula

a(n) = binomial(pi(n) + n - 1, n) where pi = A000720.

A357927 Number of subsets of [n] in which exactly half of the elements are Fibonacci numbers.

Original entry on oeis.org

1, 1, 1, 1, 4, 5, 15, 35, 56, 126, 252, 462, 792, 1716, 3003, 5005, 8008, 12376, 18564, 27132, 38760, 116280, 170544, 245157, 346104, 480700, 657800, 888030, 1184040, 1560780, 2035800, 2629575, 3365856, 4272048, 18156204, 23535820, 30260340, 38608020, 48903492
Offset: 0

Views

Author

Alois P. Heinz, Oct 20 2022

Keywords

Examples

			a(6) = 15: {}, {1,4}, {1,6}, {2,4}, {2,6}, {3,4}, {3,6}, {4,5}, {5,6}, {1,2,4,6}, {1,3,4,6}, {1,4,5,6}, {2,3,4,6}, {2,4,5,6}, {3,4,5,6}.
		

Crossrefs

Programs

  • Maple
    f:= proc(n) option remember; `if`(n=0, 0, f(n-1)+
         `if`((t-> ormap(issqr, [t-4, t+4]))(5*n^2), 1, 0))
        end:
    a:= n-> binomial(n, f(n)):
    seq(a(n), n=0..38);
  • Mathematica
    f[n_] := Module[{j}, For[j = Floor@Log[GoldenRatio, n], Fibonacci[j+1] <= n, j++]; j-1];
    a[n_] := If[n == 0, 1, Binomial[n, f[n]]];
    Table[a[n], {n, 0, 38}] (* Jean-François Alcover, Nov 17 2022 *)

Formula

a(n) = binomial(n,A072649(n)).
a(n) = Sum_{j>=0} binomial(A072649(n),j)*binomial(n-A072649(n),j).

A377505 a(n) is the number of positive integers that have Omega(n) prime factors and these are all <= n.

Original entry on oeis.org

1, 1, 2, 3, 3, 6, 4, 20, 10, 10, 5, 35, 6, 21, 21, 126, 7, 84, 8, 120, 36, 36, 9, 495, 45, 45, 165, 165, 10, 220, 11, 3003, 66, 66, 66, 1001, 12, 78, 78, 1365, 13, 455, 14, 560, 560, 105, 15, 11628, 120, 680, 120, 680, 16, 3876, 136, 3876, 136, 136, 17, 4845, 18
Offset: 1

Views

Author

Felix Huber, Dec 20 2024

Keywords

Comments

If drawing at random with replacement from the primes <= n as many as n has prime factors, 1/a(n) is the probability that the product of the prime numbers drawn is equal to n.

Examples

			a(4) = 3 because 3 positive integers have Omega(4) = 2 prime factors <= 4: 4 = 2*2, 6 = 2*3, 9 = 3*3.
a(6) = 6 because 6 positive integers have Omega(6) = 2 prime factors <= 6: 4 = 2*2, 6 = 2*3, 9 = 3*3, 10 = 2*5, 15 = 3*5, 25 = 5*5.
a(7) = 4 because 4 positive integers have Omega(7) = 1 prime factor <= 7: 2, 3, 5, 7.
		

Crossrefs

Programs

  • Maple
    with(NumberTheory):
    A377505:=n->binomial(pi(n)+Omega(n)-1,Omega(n));
    seq(A377505(n),n=1..61);
  • Mathematica
    Table[Binomial[PrimePi[n]+PrimeOmega[n]-1,PrimeOmega[n]],{n,61}] (* James C. McMahon, Dec 24 2024 *)

Formula

a(n) = binomial(pi(n) + Omega(n) - 1, Omega(n)) where pi = A000720 and Omega = A001222.
a(p) = pi(p) for prime p.
Showing 1-8 of 8 results.