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-10 of 12 results. Next

A127542 Number of subsets of {1,2,3,...,n} whose sum is prime.

Original entry on oeis.org

0, 2, 4, 7, 12, 22, 42, 76, 139, 267, 516, 999, 1951, 3824, 7486, 14681, 28797, 56191, 108921, 210746, 410016, 804971, 1591352, 3153835, 6249154, 12380967, 24553237, 48731373, 96622022, 191012244, 376293782, 739671592, 1454332766, 2867413428, 5678310305
Offset: 1

Views

Author

Emeric Deutsch, Mar 03 2007

Keywords

Examples

			The subsets of {1,2,3} that sum to a prime are {1,2}, {2}, {3}, {2,3}. Thus a(3)=4.
		

Crossrefs

Row sums of A282516.

Programs

  • Haskell
    import Data.List (subsequences)
    a127542 = length . filter ((== 1) . a010051 . sum) .
                              subsequences . enumFromTo 1
    -- Reinhard Zumkeller, Feb 22 2012, Oct 27 2010
    
  • Maple
    with(combinat): a:=proc(n) local ct, pn, j:ct:=0: pn:=powerset(n): for j from 1 to 2^n do if isprime(add(pn[j][i],i=1..nops(pn[j]))) =true then ct:=ct+1 else ct:=ct fi: od: end: seq(a(n),n=1..18);
    # second Maple program:
    b:= proc(n, s) option remember; `if`(n=0,
         `if`(isprime(s), 1, 0), b(n-1, s)+b(n-1, s+n))
        end:
    a:= n-> b(n, 0):
    seq(a(n), n=1..44);  # Alois P. Heinz, Oct 22 2023
  • Mathematica
    g[n_] := Block[{p = Product[1 + z^i, {i, n}]},Sum[Boole[PrimeQ[k]]*Coefficient[p, z, k], {k, 0, n*(n + 1)/2}]];Array[g, 34] (* Ray Chandler, Mar 05 2007 *)
  • PARI
    a(n)=my(v=Vec(prod(i=1,n,x^i+1)),s);forprime(p=2,#v,s+=v[p]);s \\ Charles R Greathouse IV, Dec 19 2014
    
  • PARI
    first(n)=my(v=vector(n),P=1,s); for(k=1,n, P*=1+'x^n; s=0; forprime(p=2,k*(k+1)/2,s+=polcoeff(P,p)); v[k]=s); v \\ Charles R Greathouse IV, Dec 19 2014

Extensions

Extended by Ray Chandler, Mar 05 2007

A071917 Number of pairs (x,y) where x is even, y is odd, 1<=x<=n, 1<=y<=n and x+y is prime.

Original entry on oeis.org

0, 1, 2, 4, 5, 7, 9, 11, 14, 18, 21, 25, 28, 31, 35, 40, 44, 48, 52, 56, 61, 67, 72, 78, 84, 90, 97, 104, 110, 117, 124, 131, 138, 146, 154, 163, 172, 181, 190, 200, 209, 219, 228, 237, 247, 257, 266, 275, 285, 295, 306, 318, 329, 341, 354, 367, 381, 395, 408, 421
Offset: 1

Views

Author

Enoch Haga, Jun 13 2002

Keywords

Examples

			a(6)=7: The sums x+y are 2+1, 2+3, 2+5, 4+1, 4+3, 6+1, 6+5.
		

Crossrefs

Cf. A000720.
Column k=2 of A282516.

Programs

  • Maple
    with(numtheory):
    a:= proc(n) option remember; `if`(n=0, 0,
          a(n-1)+pi(2*n-1)-pi(n))
        end:
    seq(a(n), n=1..70);  # Alois P. Heinz, Feb 03 2017
  • Mathematica
    a[n_] := Sum[If[PrimeQ[p], Min[p-1, 2n+1-p]/2, 0], {p, 3, 2n-1}]

Formula

a(n) = sum over primes p from 3 to 2n-1 of min(p-1, 2n+1-p)/2.
a(n) = a(n-1) + pi(2*n-1) - pi(n) for n>0, a(0) = 0. - Alois P. Heinz, Feb 03 2017

Extensions

Edited by Dean Hickerson, Jun 18 2002

A282517 Number of n-element subsets of [2n] having a prime element sum.

Original entry on oeis.org

0, 1, 4, 6, 21, 59, 239, 760, 2970, 10060, 38930, 124735, 503767, 1986024, 7059818, 27806989, 107739266, 376458328, 1421570461, 5750402871, 23095812036, 89360066340, 315720338715, 1202284699132, 5133364318360, 20343420316531, 74430884941912, 279471388089807
Offset: 0

Views

Author

Alois P. Heinz, Feb 17 2017

Keywords

Examples

			a(1) = 1: {2}.
a(2) = 4: {1,2}, {1,4}, {2,3}, {3,4}.
a(3) = 6: {1,2,4}, {1,4,6}, {2,3,6}, {2,4,5}, {2,5,6}, {3,4,6}.
a(4) = 21: {1,2,3,5}, {1,2,3,7}, {1,2,4,6}, {1,2,6,8}, {1,3,4,5}, {1,3,5,8}, {1,3,6,7}, {1,3,7,8}, {1,4,5,7}, {1,4,6,8}, {1,5,6,7}, {2,3,4,8}, {2,3,5,7}, {2,3,6,8}, {2,4,5,6}, {2,4,5,8}, {2,4,6,7}, {2,6,7,8}, {3,4,5,7}, {3,5,7,8}, {4,5,6,8}.
		

Crossrefs

Cf. A282516.

Formula

a(n) = A282516(2n,n).

A282518 Number of n-element subsets of [n+1] having a prime element sum.

Original entry on oeis.org

0, 1, 2, 1, 2, 2, 1, 2, 3, 2, 2, 3, 3, 3, 3, 2, 4, 3, 3, 4, 4, 4, 4, 4, 4, 4, 4, 5, 5, 6, 4, 5, 3, 6, 6, 7, 5, 5, 6, 4, 8, 5, 6, 6, 8, 6, 8, 5, 7, 5, 11, 4, 6, 9, 7, 8, 9, 8, 7, 7, 9, 7, 8, 7, 12, 5, 9, 9, 11, 9, 7, 7, 12, 10, 10, 9, 9, 9, 6, 11, 10, 11, 9, 12
Offset: 0

Views

Author

Alois P. Heinz, Feb 17 2017

Keywords

Examples

			a(1) = 1: {2}.
a(2) = 2: {1,2}, {2,3}.
a(3) = 1: {1,2,4}.
a(4) = 2: {1,2,3,5}, {1,3,4,5}.
a(5) = 2: {1,2,3,5,6}, {1,3,4,5,6}.
a(6) = 1: {1,2,3,4,6,7}.
a(7) = 2: {1,2,3,4,5,6,8}, {1,2,3,4,6,7,8}.
a(8) = 3: {1,2,3,4,5,6,7,9}, {1,2,3,5,6,7,8,9}, {1,3,4,5,6,7,8,9}.
		

Crossrefs

Similar but different: A065382, A066888, A090970.

Programs

  • Maple
    a:= proc(n) option remember; (t-> add(`if`(isprime(
           t-i), 1, 0), i=1..n+1))((n+1)*(n+2)/2)
        end:
    seq(a(n), n=0..100);

Formula

a(n) = A282516(n+1,n).
a(n) = pi((n+1)*(n+2)/2)-pi(n*(n+1)/2) for n >= 3, pi = A000720.

A320678 Number of 3-element subsets of [n] having a prime element sum.

Original entry on oeis.org

0, 1, 2, 6, 10, 18, 26, 37, 47, 62, 76, 96, 116, 143, 170, 205, 241, 285, 329, 382, 434, 495, 555, 627, 698, 781, 865, 962, 1059, 1168, 1276, 1397, 1517, 1652, 1786, 1936, 2086, 2253, 2419, 2600, 2779, 2974, 3168, 3378, 3588, 3818, 4048, 4296, 4543, 4809, 5073
Offset: 3

Views

Author

Alois P. Heinz, Oct 19 2018

Keywords

Crossrefs

Column k=3 of A282516.

A320679 Number of 4-element subsets of [n] having a prime element sum.

Original entry on oeis.org

0, 2, 4, 11, 21, 34, 53, 82, 118, 171, 241, 332, 444, 582, 741, 931, 1152, 1411, 1712, 2064, 2465, 2930, 3451, 4034, 4683, 5406, 6200, 7085, 8058, 9128, 10301, 11588, 12980, 14498, 16132, 17885, 19758, 21760, 23885, 26159, 28579, 31157, 33901, 36826, 39923
Offset: 4

Views

Author

Alois P. Heinz, Oct 19 2018

Keywords

Crossrefs

Column k=4 of A282516.

A320680 Number of 5-element subsets of [n] having a prime element sum.

Original entry on oeis.org

0, 2, 7, 13, 31, 59, 110, 191, 322, 497, 743, 1053, 1469, 1998, 2698, 3574, 4696, 6051, 7710, 9663, 11998, 14718, 17957, 21715, 26130, 31196, 37041, 43632, 51121, 59468, 68839, 79212, 90775, 103504, 117648, 133203, 150449, 169407, 190387, 213403, 238807
Offset: 5

Views

Author

Alois P. Heinz, Oct 19 2018

Keywords

Crossrefs

Column k=5 of A282516.

A320681 Number of 6-element subsets of [n] having a prime element sum.

Original entry on oeis.org

0, 1, 7, 20, 51, 117, 239, 430, 724, 1163, 1834, 2823, 4252, 6226, 8870, 12299, 16712, 22340, 29524, 38606, 49979, 63965, 80946, 101250, 125316, 153592, 186694, 225268, 270172, 322285, 382716, 452614, 533380, 626424, 733387, 855881, 995740, 1154735, 1334850
Offset: 6

Views

Author

Alois P. Heinz, Oct 19 2018

Keywords

Crossrefs

Column k=6 of A282516.

A320682 Number of 7-element subsets of [n] having a prime element sum.

Original entry on oeis.org

0, 2, 7, 32, 85, 191, 383, 760, 1429, 2601, 4455, 7275, 11312, 17084, 25203, 36725, 52631, 74199, 102482, 138942, 184934, 242638, 314286, 403242, 513039, 648580, 814890, 1018701, 1266791, 1567831, 1930440, 2365171, 2882192, 3493959, 4212425, 5052278, 6027955
Offset: 7

Views

Author

Alois P. Heinz, Oct 19 2018

Keywords

Crossrefs

Column k=7 of A282516.

A320683 Number of 8-element subsets of [n] having a prime element sum.

Original entry on oeis.org

0, 3, 11, 35, 101, 275, 669, 1486, 2970, 5474, 9514, 16071, 26652, 43301, 68207, 103901, 153339, 220576, 311048, 432343, 594218, 809436, 1093733, 1466746, 1951992, 2577872, 3377119, 4387788, 5652659, 7220623, 9146776, 11494964, 14338214, 17762174, 21865783
Offset: 8

Views

Author

Alois P. Heinz, Oct 19 2018

Keywords

Crossrefs

Column k=8 of A282516.
Showing 1-10 of 12 results. Next