OFFSET
1,2
FORMULA
EXAMPLE
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}.
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 *)
PROG
(PARI) a(n) = primepi(n) * 2^(n-primepi(n)); \\ Michel Marcus, Nov 07 2020
CROSSREFS
KEYWORD
nonn
AUTHOR
Reinhard Zumkeller, Nov 12 2003
STATUS
approved