A089820 Number of subsets of {1,..,n} containing at least one prime.
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
Links
- Vincenzo Librandi, Table of n, a(n) for n = 1..1000
Programs
-
Magma
[2^n-2^(n-#PrimesUpTo(n)) : n in [1..30]]; // Wesley Ivan Hurt, Sep 19 2014
-
Maple
with(numtheory): A089820:=n->2^n - 2^(n-pi(n)): seq(A089820(n), n=1..30); # Wesley Ivan Hurt, Sep 19 2014
-
Mathematica
Table[2^n - 2^(n - PrimePi[n]), {n, 30}] (* Wesley Ivan Hurt, Sep 19 2014 *)
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
Comments