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 20 results. Next

A034961 Sums of three consecutive primes.

Original entry on oeis.org

10, 15, 23, 31, 41, 49, 59, 71, 83, 97, 109, 121, 131, 143, 159, 173, 187, 199, 211, 223, 235, 251, 269, 287, 301, 311, 319, 329, 349, 371, 395, 407, 425, 439, 457, 471, 487, 503, 519, 533, 551, 565, 581, 589, 607, 633, 661, 679, 689, 701, 713, 731, 749, 771
Offset: 1

Views

Author

Patrick De Geest, Oct 15 1998

Keywords

Comments

For prime terms see A034962. - Zak Seidov, Feb 17 2011

Examples

			a(1) = 10 = 2 + 3 + 5.
a(42) = 565 = 181 + 191 + 193.
		

Crossrefs

Programs

  • Magma
    [&+[ NthPrime(n+k): k in [0..2] ]: n in [1..50] ]; // Vincenzo Librandi, Apr 03 2011
    
  • Mathematica
    Plus @@@ Partition[ Prime[ Range[60]], 3, 1] (* Robert G. Wilson v, Feb 11 2005 *)
    3 MovingAverage[Prime[Range[60]], {1, 1, 1}] (* Jean-François Alcover, Nov 12 2018 *)
  • PARI
    a(n)=my(p=prime(n),q=nextprime(p+1)); p+q+nextprime(q+1) \\ Charles R Greathouse IV, Jul 01 2013
    
  • PARI
    is(n)=my(p=precprime(n\3),q=nextprime(n\3+1),r=n-p-q); if(r>q, r==nextprime(q+2), r==precprime(p-1) && r) \\ Charles R Greathouse IV, Jul 05 2017
    
  • Python
    from sympy import nextprime
    from itertools import count, islice
    def agen(): # generator of terms
        p, q, r = 2, 3, 5
        while True:
            yield p + q + r
            p, q, r = q, r, nextprime(r)
    print(list(islice(agen(), 54))) # Michael S. Branicky, Dec 27 2022
  • Sage
    BB = primes_first_n(57)
    L = []
    for i in range(55):
        L.append(BB[i]+BB[i+1]+BB[i+2])
    L # Zerinvary Lajos, May 14 2007
    

Formula

a(n) = Sum_{k=0..2} A000040(n+k). - Omar E. Pol, Feb 28 2020
a(n) = A001043(n) + A000040(n+2). - R. J. Mathar, May 25 2020

A034963 Sums of four consecutive primes.

Original entry on oeis.org

17, 26, 36, 48, 60, 72, 88, 102, 120, 138, 152, 168, 184, 202, 220, 240, 258, 272, 290, 306, 324, 348, 370, 390, 408, 420, 432, 456, 480, 508, 534, 556, 576, 596, 620, 638, 660, 682, 700, 724, 744, 762, 780, 800, 830, 860, 890, 912, 928, 942, 964, 988, 1012
Offset: 1

Views

Author

Patrick De Geest, Oct 15 1998

Keywords

Examples

			a(7) = 17 + 19 + 23 + 29 = 88.
		

Crossrefs

Programs

Formula

a(n) = Sum_{k=0..3} A000040(n+k). - Omar E. Pol, Mar 02 2020

A034962 Primes that are the sum of three consecutive primes.

Original entry on oeis.org

23, 31, 41, 59, 71, 83, 97, 109, 131, 173, 199, 211, 223, 251, 269, 311, 349, 439, 457, 487, 503, 607, 661, 701, 829, 857, 883, 911, 941, 1033, 1049, 1061, 1151, 1187, 1229, 1249, 1303, 1367, 1381, 1409, 1433, 1493, 1511, 1553, 1667, 1867, 1931, 1973, 1993
Offset: 1

Views

Author

Patrick De Geest, Oct 15 1998

Keywords

Comments

Or, primes in A034961 (Sums of three consecutive primes). - Zak Seidov, Feb 16 2011

Examples

			E.g., 131 = 41 + 43 + 47.
A034962(n) = p+q+r, where p = A073681(n), and p<q<r are three consecutive primes. - _Zak Seidov_, Mar 09 2009
		

Crossrefs

Cf. A001043, A011974, A034707, A034961. Different from A050207.
Cf. A073681 (smallest of three consecutive primes whose sum is a prime).

Programs

  • Magma
    [a: n in [1..150] | IsPrime(a) where a is NthPrime(n)+NthPrime(n+1)+NthPrime(n+2)]; // Vincenzo Librandi, Jun 23 2016
    
  • Maple
    a:=proc(n) if isprime(ithprime(n)+ithprime(n+1)+ithprime(n+2))=true then ithprime(n)+ithprime(n+1)+ithprime(n+2) else fi end: seq(a(n), n=1..120); # Emeric Deutsch, Apr 24 2006
  • Mathematica
    a = {}; Do[k = Prime[x] + Prime[x + 1] + Prime[x + 2]; If[PrimeQ[k], AppendTo[a, k]], {x, 1, 350}]; a (* Artur Jasinski, Jan 27 2007 *)
    Select[(Plus@@@Partition[Prime[Range[200]],3,1]),PrimeQ] (* Zak Seidov, Feb 07 2012 *)
    Select[ListConvolve[{1,1,1},Prime[Range[200]]],PrimeQ] (* Harvey P. Dale, Jul 12 2013 *)
  • PARI
    forprime(p=2,1000, p2=nextprime(p+1); p3=nextprime(p2+1); q=p+p2+p3; if(isprime(q),print1(q",")) ) \\ Max Alekseyev, Jan 26 2007
    
  • PARI
    {p=2;q=3;for(n=1,100,r=nextprime(q+1); if(isprime(t=p+q+r),print1(t","));p=q;q=r;)} \\ Zak Seidov, Mar 09 2009
    
  • Python
    from itertools import count, islice
    from sympy import isprime, nextprime
    def agen(): # generator of terms
        p, q, r = 2, 3, 5
        while True:
            if isprime(p+q+r): yield p+q+r
            p, q, r = q, r, nextprime(r)
    print(list(islice(agen(), 50))) # Michael S. Branicky, Dec 27 2022

A050936 Sum of two or more consecutive prime numbers.

Original entry on oeis.org

5, 8, 10, 12, 15, 17, 18, 23, 24, 26, 28, 30, 31, 36, 39, 41, 42, 48, 49, 52, 53, 56, 58, 59, 60, 67, 68, 71, 72, 75, 77, 78, 83, 84, 88, 90, 95, 97, 98, 100, 101, 102, 109, 112, 119, 120, 121, 124, 127, 128, 129, 131, 132, 138, 139, 143, 144, 150, 152, 155, 156, 158, 159, 160, 161, 162
Offset: 1

Views

Author

G. L. Honaker, Jr., Dec 31 1999

Keywords

Examples

			E.g., 5 = (2 + 3) or (#2,2).
2+3 = 5, 3+5 = 8, 2+3+5 = 10, 7+5 = 12, 3+5+7 = 15, etc.
		

Crossrefs

Subsequence of A034707.
A084143(a(n)) > 0, complement of A087072.

Programs

  • Haskell
    import Data.Set (empty, findMin, deleteMin, insert)
    import qualified Data.Set as Set (null)
    a050936 n = a050936_list !! (n-1)
    a050936_list = f empty [2] 2 $ tail a000040_list where
       f s bs c (p:ps)
         | Set.null s || head bs <= m = f (foldl (flip insert) s bs') bs' p ps
         | otherwise                  = m : f (deleteMin s) bs c (p:ps)
         where m = findMin s
               bs' = map (+ p) (c : bs)
    -- Reinhard Zumkeller, Aug 26 2011
    
  • Maple
    # uses code of A084143
    isA050936 := proc(n::integer)
        if A084143(n) >= 1 then
            true;
        else
            false;
        end if;
    end proc:
    for n from 1 to 300 do
        if isA050936(n) then
            printf("%d,",n);
        end if;
    end do: # R. J. Mathar, Aug 19 2020
  • Mathematica
    lst={};Do[p=Prime[n];Do[p=p+Prime[k];AppendTo[lst, p], {k, n+1, 2*10^2}], {n, 2*10^2}];Take[Union[lst], 10^2] (* Vladimir Joseph Stephan Orlovsky, Aug 21 2008 *)
    f[n_] := Block[{len = PrimePi@ n}, p = Prime@ Range@ len; Count[ Flatten[ Table[ p[[i ;; j]], {i, len}, {j, i+1, len}],1], q_ /; Total@ q == n]]; Select[ Range@ 150, f@ # > 0 &] (* Or quicker for a larger range *)
    lmt = 150; p = Prime@ Range@ PrimePi@ lmt; t = Table[0, {lmt}]; Do[s = 0; j = i+1; While[s = s + p[[j]]; s <= lmt, t[[s]]++; j++], {i, Length@ p}]; Select[ Range@ lmt, t[[#]] > 0 &] (* Robert G. Wilson v *)
    Module[{nn=70,prs},prs=Prime[Range[nn]];Take[Union[Flatten[Table[Total/@ Partition[prs,i,1],{i,2,nn}]]],nn]] (* Harvey P. Dale, Nov 13 2013 *)
  • PARI
    is(n)=my(v,m=1,t); while(1,v=vector(m++); v[m\2]=precprime(n\m); for(i=m\2+1,m, v[i]=nextprime(v[i-1]+1)); forstep(i=m\2-1,1,-1, v[i]=precprime(v[i+1]-1)); if(v[1]==0, return(0)); t=vecsum(v); if(t==n,return(1)); if(t>n, while(t>n,t-=v[m]; v=concat(precprime(v[1]-1), v[1..m-1]); t+=v[1]), while(tCharles R Greathouse IV, May 05 2016
    
  • PARI
    list(lim)=my(v=List(),s,n=1,p); while(1, p=2; s=vecsum(primes(n++)); if(s>lim,return(Set(v))); listput(v,s); forprime(q=prime(n+1),, s+=q-p; if(s>lim,break); listput(v,s); p=nextprime(p+1))); \\ Charles R Greathouse IV, Nov 24 2021

Extensions

More terms from David W. Wilson, Jan 13 2000

A034964 Sums of five consecutive primes.

Original entry on oeis.org

28, 39, 53, 67, 83, 101, 119, 139, 161, 181, 199, 221, 243, 263, 287, 311, 331, 351, 373, 395, 421, 449, 473, 497, 517, 533, 559, 587, 617, 647, 683, 707, 733, 759, 787, 811, 839, 863, 891, 917, 941, 961, 991, 1023, 1057, 1089, 1123, 1151, 1169, 1193
Offset: 1

Views

Author

Patrick De Geest, Oct 15 1998

Keywords

Comments

Except for the first term, all terms are odd. - Alonso del Arte, Dec 30 2011

Examples

			a(1) = prime(1+0) + prime(1+1) + prime(1+2) + prime(1+3) + prime(1+4) = 2 + 3 + 5 + 7 + 11 = 28.
a(2) = prime(2+0) + prime(2+1) + prime(2+2) + prime(2+3) + prime(2+4) = 3 + 5 + 7 + 11 + 13 = 39.
		

References

  • Owen O'Shea and Underwood Dudley, The Magic Numbers of the Professor, Mathematical Association of America (2007), p. 62

Crossrefs

Cf. A131686 (sums of five consecutive squares of primes).

Programs

  • Magma
    [&+[ NthPrime(n+k): k in [0..4] ]: n in [1..100] ]; // Vincenzo Librandi, Apr 03 2011
    
  • Maple
    A034964:=n->add(ithprime(i), i=n..n+4): seq(A034964(n), n=1..50); # Wesley Ivan Hurt, Sep 14 2014
  • Mathematica
    Plus@@@Partition[Prime[Range[100]],5,1] (* Vladimir Joseph Stephan Orlovsky, Feb 18 2010 *)
  • PARI
    a(n) = sum(k=n, n+4, prime(k)); \\ Michel Marcus, Sep 03 2016
    
  • PARI
    first(n) = {my(psum = 28, pr = List([2,3,5,7,11]), res = List([28])); for(i=2,n, psum -= pr[1]; listpop(pr, 1); listput(pr, nextprime(pr[4] + 1)); psum += pr[5]; listput(res, psum)); res} \\ David A. Corneth, Oct 14 2017
  • Sage
    BB = primes_first_n(60)
    L = []
    for i in range(55):
        L.append(BB[i]+BB[i+1]+BB[i+2]+BB[i+3]+BB[i+4])
    L # Zerinvary Lajos, May 14 2007
    

Formula

a(n) = Sum_{i=n..n+4} prime(i). - Wesley Ivan Hurt, Sep 14 2014

Extensions

Offset changed to 1 by Joerg Arndt, Sep 04 2016

A054643 Primes prime(n) such that prime(n) + prime(n+1) + prime(n+2) == 0 (mod 3).

Original entry on oeis.org

3, 47, 151, 167, 199, 251, 257, 367, 503, 523, 557, 587, 601, 647, 727, 941, 971, 991, 1063, 1097, 1117, 1181, 1217, 1231, 1361, 1453, 1493, 1499, 1531, 1741, 1747, 1753, 1759, 1889, 1901, 1907, 2063, 2161, 2281, 2393, 2399, 2411, 2441, 2671, 2897, 2957
Offset: 1

Views

Author

Labos Elemer, May 15 2000

Keywords

Comments

The 2 differences of these 3 primes should be congruent of 6, except the first prime 3, for which 3 + 5 + 7 = 15 holds. Sequences like A047948, A052198 etc. are subsequences here.

Examples

			For prime(242) = 1531, the sum is 4623, the mean is 1541 and the successive differences are 6a=12 or 6b=6 resp.
		

Crossrefs

A122535 is a subsequence.
Cf. A075541 (for their indices).

Programs

  • Mathematica
    Select[Partition[Prime@ Range@ 430, 3, 1], Divisible[Total@ #, 3] &][[All, 1]] (* Michael De Vlieger, Jun 29 2017 *)

A034965 Primes that are sum of five consecutive primes.

Original entry on oeis.org

53, 67, 83, 101, 139, 181, 199, 263, 311, 331, 373, 421, 449, 587, 617, 647, 683, 733, 787, 811, 839, 863, 941, 991, 1123, 1151, 1193, 1361, 1381, 1579, 1609, 1801, 1831, 1861, 1949, 1979, 2081, 2113, 2143, 2221, 2273, 2297, 2357, 2423, 2459, 2689, 2731
Offset: 1

Views

Author

Patrick De Geest, Oct 15 1998

Keywords

Examples

			53 = 5 + 7 + 11 + 13 + 17.
373 = 67 + 71 + 73 + 79 + 83.
		

Crossrefs

Cf. A001043, A011974, A034707, A152468. Also Cf. A034964, of which this sequence is a subset.

Programs

  • Maple
    ts_prod_n:=proc(n) local i,ans; ans:=[ ]: for i from 1 to n do if isprime(ithprime(i)+ithprime(i+1)+ithprime(i+2)+ithprime(i+3)+ithprime(i+4))= 'true' then ans:=[op(ans), ithprime(i)+ithprime(i+1)+ithprime(i+2)+ithprime(i+3)+ithprime(i+4) ]: fi od: end: ts_prod_n(701); # Jani Melik, May 05 2006
  • Mathematica
    Select[Table[Plus@@Prime[Range[n, n + 4]], {n, 200}], PrimeQ] (* Alonso del Arte, Dec 30 2011 *)
    Select[Total/@Partition[Prime[Range[200]],5,1],PrimeQ] (* Harvey P. Dale, May 24 2012 *)

Extensions

Corrected example by Paul S. Coombes, Dec 29 2011

A307610 Number of partitions of prime(n) into consecutive primes.

Original entry on oeis.org

1, 1, 2, 1, 1, 1, 2, 1, 2, 1, 2, 1, 3, 1, 1, 2, 2, 1, 2, 2, 1, 1, 3, 1, 2, 2, 1, 1, 2, 1, 2, 2, 1, 2, 1, 1, 1, 1, 1, 2, 1, 2, 1, 1, 3, 3, 2, 3, 1, 1, 2, 1, 1, 3, 1, 2, 2, 2, 1, 3, 1, 1, 1, 5, 1, 1, 2, 1, 1, 2, 2, 1, 1, 2, 2, 1, 1, 1, 3, 1, 1, 2, 2, 1, 3, 2, 2, 2, 1, 2, 1, 2, 2, 3, 2, 2, 1, 1, 2
Offset: 1

Views

Author

Ilya Gutkovskiy, Apr 18 2019

Keywords

Comments

a(n) - 1 = number of partitions of prime(n) into two or more consecutive primes. - Ray Chandler, Sep 26 2023

Examples

			prime(13) = 41 = 2 + 3 + 5 + 7 + 11 + 13 = 11 + 13 + 17, so a(13) = 3.
		

Crossrefs

Formula

a(n) = [x^prime(n)] Sum_{i>=1} Sum_{j>=i} Product_{k=i..j} x^prime(k).
a(n) = A054845(A000040(n)).

A050940 Numbers that are not the sum (of a nonempty sequence) of consecutive primes.

Original entry on oeis.org

0, 1, 4, 6, 9, 14, 16, 20, 21, 22, 25, 27, 32, 33, 34, 35, 38, 40, 44, 45, 46, 50, 51, 54, 55, 57, 62, 63, 64, 65, 66, 69, 70, 74, 76, 80, 81, 82, 85, 86, 87, 91, 92, 93, 94, 96, 99, 104, 105, 106, 108, 110, 111, 114, 115, 116, 117, 118, 122, 123, 125
Offset: 1

Views

Author

N. J. A. Sloane, Jan 02 2000

Keywords

Comments

Where is there a proof that this sequence is infinite? - Carlos Rivera, Apr 17 2002
Moser shows that the average order of A054845 is log(2), and hence this sequence is infinite with lower density at least 1 - log 2 = 0.306.... - Charles R Greathouse IV, Mar 21 2011

Examples

			The number 14 cannot be expressed as a sum of any consecutive subset of the following primes: {2, 3, 5, 7, 11, 13}.
		

Crossrefs

Complement of A034707.

Programs

  • BASIC
    10 N=1 20 N=N+1: if N=prmdiv(N) then goto 20 30 P=1 40 P=nxtprm(P):S=P:Q=P: if S>N\2 then print N;:goto 20 50 Q=nxtprm(Q):S=S+Q 60 if S=N then goto 20 70 if S>N then goto 40 80 goto 50
    
  • PARI
    is(n)=if(isprime(n), return(0)); my(v,m=1,t); while(1, v=vector(m++); v[m\2]=precprime(n\m); for(i=m\2+1,m,v[i]=nextprime(v[i-1]+1)); forstep(i=m\2-1,1,-1,v[i]=precprime(v[i+1]-1)); if(v[1]==0, return(1)); t=vecsum(v); if (t==n, return(0)); if(t>n, while(t>n, t-=v[m]; v=concat(precprime(v[1]-1), v[1..m-1]); t+=v[1]), while(tCharles R Greathouse IV, May 05 2016

Formula

A054845(a(n)) = 0. - Ray Chandler, Sep 20 2023

A340771 Numbers which are the sum of some number of consecutive prime squares.

Original entry on oeis.org

4, 9, 13, 25, 34, 38, 49, 74, 83, 87, 121, 169, 170, 195, 204, 208, 289, 290, 339, 361, 364, 373, 377, 458, 529, 579, 628, 650, 653, 662, 666, 819, 841, 890, 940, 961, 989, 1014, 1023, 1027, 1179, 1348, 1369, 1370, 1469, 1518, 1543, 1552, 1556, 1681, 1731, 1802, 1849
Offset: 1

Views

Author

Michel Marcus, Jan 20 2021

Keywords

Examples

			The initial terms are 2^2, 3^2, 2^2+3^2, 5^2, 3^2+5^2, ...
		

Crossrefs

Programs

  • Maple
    N:= 10000: # for terms <= N
    PS:= [0,seq(ithprime(i)^2,i=1..numtheory:-pi(floor(sqrt(N))))]:
    SPS:= ListTools:-PartialSums(PS):
    sort(convert(select(`<=`,{seq(seq(SPS[t]-SPS[s],s=1..t-1),t=2..nops(SPS))},N),list)); # Robert Israel, Jan 20 2021
  • PARI
    lista(nn) = {my(list = List(), ip = primepi(nn), vp = primes(ip)); for(i=1, ip, my(s=vp[i]^2); listput(list, s); for (j=i+1, ip, s += vp[j]^2; if (s >vp[ip]^2, break); listput(list, s););); Vec(vecsort(list,,8));} \\ Michel Marcus, Jan 20 2021
Showing 1-10 of 20 results. Next