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.

A071810 Number of subsets of the first n primes whose sum is a prime.

Original entry on oeis.org

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

Views

Author

Robert G. Wilson v, Jun 06 2002

Keywords

Comments

a(n+1) < 2*a(n) fails for n = 1, 332 and other larger values of n. - Don Reble, Sep 07 2006
Here is one way to compute this sequence. Compute f_n(x) = Product_{k=1..n} 1+x^prime(k) = f_{n-1}(x) * (1+x^prime(n)). Then sum the coefficients of x^p in f_n(x) for p prime. You only need to look at primes <= the sum of the first n primes. - Franklin T. Adams-Watters, Sep 07 2006

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.
		

Crossrefs

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

A066028 Largest prime which can be written as a sum of distinct primes <= prime(n).

Original entry on oeis.org

2, 5, 7, 17, 23, 41, 53, 67, 97, 127, 157, 197, 233, 281, 317, 379, 433, 499, 563, 631, 709, 773, 863, 953, 1051, 1153, 1259, 1361, 1471, 1583, 1709, 1831, 1979, 2113, 2273, 2417, 2579, 2731, 2909, 3079, 3259, 3433, 3631, 3823, 4021, 4219, 4423, 4651
Offset: 1

Views

Author

Reinhard Zumkeller, Dec 11 2001

Keywords

Comments

Sequence is nondecreasing by definition. Is it strictly increasing? - Charles R Greathouse IV, Jun 20 2013
a(n) = A256015(n,A108018(n)). - Reinhard Zumkeller, Jun 01 2015

Examples

			n = 5: the following primes are sums of primes <= 11 = A000040(5): 2, 3, 5, 7, 11, 13, 17, 19 and 23 = 5+7+11 = 2+3+7+11, so a(5) = 23.
		

Crossrefs

Programs

  • Haskell
    import Data.List (subsequences)
    a066028 = maximum . filter ((== 1) . a010051') .
                        map sum . tail . subsequences . flip take a000040_list
    -- Reinhard Zumkeller, Jun 01 2015
  • Mathematica
    Reap[Do[a = {1, 4, 6}; s = Sum[Prime[i], {i, 1, n}]; q = s; While[ !PrimeQ[q] || Length[ Position[a, s - q]] > 0, q = NextPrime[q, -1]]; Print[q]; Sow[q], {n, 1, 60}]][[2, 1]] (* updated by Jean-François Alcover, Feb 10 2015 *)
    Table[Max[Select[Total/@Subsets[Prime[Range[n]],{Max[1,n-5],n}],PrimeQ]],{n,50}] (* To shorten computation time, the program only tests for the subsets of primes equal to n, n-1, n-2, n-3, n-4, and n-5 in length. *) (* Harvey P. Dale, Aug 05 2016 *)

Extensions

More terms from Robert G. Wilson v, Dec 12 2001

A256015 Triangle read by rows: n-th row contains all distinct primes which are representable as the sum of some subset of the set of first n primes.

Original entry on oeis.org

2, 2, 3, 5, 2, 3, 5, 7, 2, 3, 5, 7, 17, 2, 3, 5, 7, 11, 13, 17, 19, 23, 2, 3, 5, 7, 11, 13, 17, 19, 23, 29, 31, 41, 2, 3, 5, 7, 11, 13, 17, 19, 23, 29, 31, 37, 41, 43, 47, 53, 2, 3, 5, 7, 11, 13, 17, 19, 23, 29, 31, 37, 41, 43, 47, 53, 59, 61, 67
Offset: 1

Views

Author

Reinhard Zumkeller, Jun 01 2015

Keywords

Comments

A066028(n) = T(n,A108018(n)).

Examples

			.  1:  2 |
.  2:  2 3 | 5
.  3:  2 3 5 | 7
.  4:  2 3 5 7 | 17
.  5:  2 3 5 7 11 | 13  17  19  23
.  6:  2 3 5 7 11 13 | 17  19  23  29  31  41
.  7:  2 3 5 7 11 13 17 | 19  23  29  31  37  41  43  47  53
.  8:  2 3 5 7 11 13 17 19 | 23  29  31  37  41  43  47  53  59  61  67 .
		

Crossrefs

Cf. A010051, A000040, A108018 (row lengths), A066028 (right edge).

Programs

  • Haskell
    import Data.List (subsequences, nub, sort)
    a256015 n k = a256015_tabf !! (n-1) !! (k-1)
    a256015_row n = a256015_tabf !! (n-1)
    a256015_tabf = map (sort . filter ((== 1) . a010051') . nub .
                    map sum . tail . subsequences) (tail $ inits a000040_list)
Showing 1-3 of 3 results.