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.

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

This page as a plain text file.
%I A089821 #13 Nov 07 2020 05:38:35
%S A089821 0,2,4,8,12,24,32,64,128,256,320,640,768,1536,3072,6144,7168,14336,
%T A089821 16384,32768,65536,131072,147456,294912,589824,1179648,2359296,
%U A089821 4718592,5242880,10485760,11534336,23068672,46137344,92274688,184549376,369098752,402653184
%N A089821 Number of subsets of {1,.., n} containing exactly one prime.
%F A089821 a(n) = A000720(n)*A089819(n);
%F A089821 for n>1: a(n) = A089818(n,1).
%F A089821 a(n) = pi(n) * 2^(n-pi(n)), with pi = A000720.
%e A089821 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}.
%p A089821 b:= proc(n, c) option remember; `if`(n=0, `if`(c=0, 1, 0),
%p A089821      `if`(c<0, 0, b(n-1, c)+b(n-1, c-`if`(isprime(n), 1, 0))))
%p A089821     end:
%p A089821 a:= n-> b(n, 1):
%p A089821 seq(a(n), n=1..42);  # _Alois P. Heinz_, Dec 19 2019
%t A089821 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]]]];
%t A089821 a[n_] := b[n, 1];
%t A089821 Array[a, 42] (* _Jean-François Alcover_, Nov 07 2020, after _Alois P. Heinz_ *)
%o A089821 (PARI) a(n) = primepi(n) * 2^(n-primepi(n)); \\ _Michel Marcus_, Nov 07 2020
%Y A089821 Cf. A000720, A089818, A089819, A089822.
%K A089821 nonn
%O A089821 1,2
%A A089821 _Reinhard Zumkeller_, Nov 12 2003