A071810 Number of subsets of the first n primes whose sum is a prime.
1, 3, 5, 7, 12, 20, 35, 65, 122, 237, 448, 846, 1629, 3157, 6159, 12052, 23484, 45731, 89394, 175742, 346214, 681850, 1344838, 2657654, 5253640, 10374991, 20471626, 40401929, 79871387, 158182899, 313402605, 620776215, 1228390086, 2430853648
Offset: 1
Examples
a(4) = 7 because, besides the original 4 primes, the other 3 subsets, {2,3}, {2,5} & {2,3,5,7} also sum to a prime.
Links
- Alois P. Heinz, Table of n, a(n) for n = 1..1000 (first 100 terms from T. D. Noe)
Programs
-
Haskell
import Data.List (subsequences) a071810 = sum . map a010051' . map sum . tail . subsequences . flip take a000040_list -- Reinhard Zumkeller, Dec 16 2013
-
Mathematica
Do[ Print[ Count[ PrimeQ[Plus @@@ Subsets[ Table[ Prime[i], {i, 1, n}]]], True]], {n, 1, 22}] Table[Count[Total/@Subsets[Prime[Range[n]]],?PrimeQ],{n,20}] (* _Harvey P. Dale, Mar 03 2020 *)
Extensions
More terms from Don Reble, Sep 07 2006
Edited by N. J. A. Sloane, Sep 08 2006
Comments