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

A089822 Number of subsets of {1,.., n} containing exactly two primes.

Original entry on oeis.org

0, 0, 2, 4, 12, 24, 48, 96, 192, 384, 640, 1280, 1920, 3840, 7680, 15360, 21504, 43008, 57344, 114688, 229376, 458752, 589824, 1179648, 2359296, 4718592, 9437184, 18874368, 23592960, 47185920, 57671680, 115343360, 230686720
Offset: 1

Views

Author

Reinhard Zumkeller, Nov 12 2003

Keywords

Examples

			a(5)=12 subsets of {1,2,3,4,5} contain exactly two primes: {2,3}, {2,5}, {3,5}, {1,2,3}, {1,2,5}, {1,3,5}, {2,3,4}, {2,4,5}, {3,4,5}, {1,2,3,4}, {1,2,4,5} and {1,3,4,5}.
		

Crossrefs

Programs

  • Maple
    N:= 100: # for a(1)..a(N)
    V:= Vector(N):
    p:= 1: n:= 1: pi:= 0:
    while n <= N do
      p:= nextprime(p);
      for n from n to min(N,p-1) do
        V[n]:= pi*(pi-1)*2^(n-pi)/2;
      od;
      pi:= pi+1;
      n:= p;
    od:
    convert(V,list); # Robert Israel, Jul 14 2019
    # second Maple program:
    b:= proc(n, c) option remember; `if`(n=0, `if`(c=0, 1, 0),
         `if`(c<0, 0, b(n-1, c)+b(n-1, c-`if`(isprime(n), 1, 0))))
        end:
    a:= n-> b(n, 2):
    seq(a(n), n=1..42);  # Alois P. Heinz, Dec 19 2019
  • Mathematica
    b[n_, c_] := b[n, c] = If[n == 0, If[c == 0, 1, 0], If[c < 0, 0, b[n-1, c] + b[n-1, c - If[PrimeQ[n], 1, 0]]]];
    a[n_] := b[n, 2];
    Array[a, 42] (* Jean-François Alcover, May 30 2020, after Alois P. Heinz *)

Formula

a(n) = (pi(n)*(pi(n)-1)*2^(n-pi(n)))/2, with pi = A000720.
a(n) = A000217(A000720(n)-1)*A089819(n);
for n>2: a(n) = A089818(n,2).

A089818 T(n,k) = number of subsets of {1,..., n} containing exactly k primes, triangle read by rows, 0<=k

Original entry on oeis.org

2, 2, 2, 2, 4, 2, 4, 8, 4, 0, 4, 12, 12, 4, 0, 8, 24, 24, 8, 0, 0, 8, 32, 48, 32, 8, 0, 0, 16, 64, 96, 64, 16, 0, 0, 0, 32, 128, 192, 128, 32, 0, 0, 0, 0, 64, 256, 384, 256, 64, 0, 0, 0, 0, 0, 64, 320, 640, 640, 320, 64, 0, 0, 0, 0, 0, 128, 640, 1280, 1280, 640, 128, 0, 0, 0, 0, 0
Offset: 1

Views

Author

Reinhard Zumkeller, Nov 12 2003

Keywords

Comments

T(n,k) = T(n, A000720(n)-k) for 0<=k<=A000720(n);
T(n,k) = 0 iff k > A000720(n);
A089819(n) = T(n,0); A089821(n) = T(n,1) for n>1; A089822(n) = T(n,2) for n>2;
A089820(n) = Sum(T(n,k): 1<=k<=A000720(n));
T(n,k) = A007318(A000720(n),k) * A000079(n-A000720(n)).

Crossrefs

Cf. A000040.

Programs

  • Mathematica
    T[n_, k_] := Binomial[PrimePi[n], k] 2^(n - PrimePi[n]);
    Table[T[n, k], {n, 1, 12}, {k, 0, n-1}] // Flatten (* Jean-François Alcover, Nov 04 2020 *)

Formula

T(n, k) = binomial(pi(n), k)*2^(n-pi(n)), with pi = A000720.

A357215 a(n) = number of nonempty subsets S of {1, 2, ..., n} that contain only primes.

Original entry on oeis.org

0, 1, 3, 3, 7, 7, 15, 15, 15, 15, 31, 31, 63, 63, 63, 63, 127, 127, 255, 255, 255, 255, 511, 511, 511, 511, 511, 511, 1023, 1023, 2047, 2047, 2047, 2047, 2047, 2047, 4095, 4095, 4095, 4095, 8191, 8191, 16383, 16383, 16383, 16383, 32767, 32767, 32767, 32767
Offset: 1

Views

Author

Clark Kimberling, Sep 24 2022

Keywords

Examples

			The nonempty subsets S of {1, 2, 3, 4} that contain only primes are these: {2}, {3}, {2,3}, thus, a(4) = 3.
		

Crossrefs

Programs

  • Mathematica
    Table[-1 + 2^PrimePi[n], {n, 1, 70}]
  • Python
    from sympy import primepi
    def a(n): return 2**primepi(n) - 1
    print([a(n) for n in range(1, 51)]) # Michael S. Branicky, Sep 24 2022

Formula

a(n) = -1 + A048656(n).
a(n) = 2^A000720(n) - 1.

A089820 Number of subsets of {1,..,n} containing at least one prime.

Original entry on oeis.org

0, 2, 6, 12, 28, 56, 120, 240, 480, 960, 1984, 3968, 8064, 16128, 32256, 64512, 130048, 260096, 522240, 1044480, 2088960, 4177920, 8372224, 16744448, 33488896, 66977792, 133955584, 267911168, 536346624, 1072693248, 2146435072, 4292870144, 8585740288
Offset: 1

Views

Author

Reinhard Zumkeller, Nov 12 2003

Keywords

Comments

a(n) = Sum(A089818(n,k): 1<=k<=A000720(n)) = A000079(n)-A089819(n) = A089819(n)*A000225(A000720(n)).

Crossrefs

Programs

Formula

a(n) = 2^n - 2^(n-pi(n)) = the total number of subsets minus the number of subsets of the nonprime elements of {1,..,n}, where pi = A000720. - Greg Martin, May 13 2004

Extensions

More terms from Wesley Ivan Hurt, Sep 19 2014

A089821 Number of subsets of {1,.., n} containing exactly one prime.

Original entry on oeis.org

0, 2, 4, 8, 12, 24, 32, 64, 128, 256, 320, 640, 768, 1536, 3072, 6144, 7168, 14336, 16384, 32768, 65536, 131072, 147456, 294912, 589824, 1179648, 2359296, 4718592, 5242880, 10485760, 11534336, 23068672, 46137344, 92274688, 184549376, 369098752, 402653184
Offset: 1

Views

Author

Reinhard Zumkeller, Nov 12 2003

Keywords

Examples

			a(5)=12 subsets of {1,2,3,4,5} contain exactly one prime: {2}, {3}, {5}, {1,2}, {1,3}, {1,5}, {2,4}, {3,4}, {4,5}, {1,2,4}, {1,3,4} and {1,4,5}.
		

Crossrefs

Programs

  • Maple
    b:= proc(n, c) option remember; `if`(n=0, `if`(c=0, 1, 0),
         `if`(c<0, 0, b(n-1, c)+b(n-1, c-`if`(isprime(n), 1, 0))))
        end:
    a:= n-> b(n, 1):
    seq(a(n), n=1..42);  # Alois P. Heinz, Dec 19 2019
  • Mathematica
    b[n_, c_] := b[n, c] = If[n == 0, If[c == 0, 1, 0], If[c < 0, 0, b[n - 1, c] + b[n - 1, c - If[PrimeQ[n], 1, 0]]]];
    a[n_] := b[n, 1];
    Array[a, 42] (* Jean-François Alcover, Nov 07 2020, after Alois P. Heinz *)
  • PARI
    a(n) = primepi(n) * 2^(n-primepi(n)); \\ Michel Marcus, Nov 07 2020

Formula

a(n) = A000720(n)*A089819(n);
for n>1: a(n) = A089818(n,1).
a(n) = pi(n) * 2^(n-pi(n)), with pi = A000720.

A357214 a(n) = number of subsets S of {1, 2, ..., n} such that every number in S is a composite.

Original entry on oeis.org

1, 1, 1, 2, 2, 4, 4, 8, 16, 32, 32, 64, 64, 128, 256, 512, 512, 1024, 1024, 2048, 4096, 8192, 8192, 16384, 32768, 65536, 131072, 262144, 262144, 524288, 524288, 1048576, 2097152, 4194304, 8388608, 16777216, 16777216, 33554432, 67108864, 134217728, 134217728
Offset: 1

Views

Author

Clark Kimberling, Sep 24 2022

Keywords

Examples

			The subsets S of {1,2,3,4,5,6} such that every number in S is a composite are {}, {4}, {6}, and {4,6}, so a(6) = 4.
		

Crossrefs

Programs

  • Mathematica
    (1/2) Table[2^(n - PrimePi[n]), {n, 50}]
  • PARI
    a(n) = 1 << (n-primepi(n)-1); \\ Kevin Ryde, Sep 24 2022
  • Python
    from sympy import primepi
    def a(n): return 2**(n-primepi(n)-1)
    print([a(n) for n in range(1, 42)]) # Michael S. Branicky, Sep 24 2022
    

Formula

a(n) = (1/2)*(2^(n - A000720(n))).
a(n) = 2^A065855(n).

A339555 Number of subsets of {2..n} such that the product of the elements is a perfect power.

Original entry on oeis.org

1, 1, 1, 1, 3, 3, 5, 5, 11, 25, 41, 41, 80, 80, 144, 284, 568, 568, 1147, 1147, 2339, 4667, 8763, 8763, 17548, 35196, 67964, 135918, 273806, 273806, 548956, 548956, 1097974, 2194294, 4291446, 8608698, 17216783, 17216783, 33993999, 67979983, 135956742
Offset: 0

Views

Author

Ilya Gutkovskiy, Dec 08 2020

Keywords

Examples

			a(8) = 11 subsets: {}, {4}, {8}, {2, 4}, {2, 8}, {4, 8}, {2, 3, 6}, {2, 4, 8}, {3, 6, 8}, {2, 3, 4, 6} and {3, 4, 6, 8}.
		

Crossrefs

Formula

a(p) = a(p-1) for p prime.

Extensions

a(25)-a(40) from Alois P. Heinz, Dec 08 2020
Showing 1-7 of 7 results.