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

A089819 Number of subsets of {1,2,...,n} containing no primes.

Original entry on oeis.org

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

Views

Author

Reinhard Zumkeller, Nov 12 2003

Keywords

Comments

Equivalently, the number of subsets of {1,2,...,n} such that the product of the elements is square, where the empty set is defined to have a product of 1. - Peter Kagey, Nov 18 2017

Examples

			a(6)=8 subsets of {1,2,3,4,5,6} contain no prime: {1,4,6}, {4,6}, {1,6}, {1,4}, {6}, {4}, {1} and the empty set.
a(7) = 8 as 2^(7 - PrimePi(7)) = 2^(7-4) = 8.
		

Crossrefs

Programs

Formula

a(n) = 2^(n-PrimePi(n)), with PrimePi = A000720.
a(n) = Product_{k=1..n} (2-A010051(k)) = A089818(n,0) = A000079(n) - A089820(n).
a(n) = 2^(1-A010051(n))*a(n-1). - Robert Israel, Nov 22 2017

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.
Showing 1-3 of 3 results.