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-7 of 7 results.

A007504 Sum of the first n primes.

Original entry on oeis.org

0, 2, 5, 10, 17, 28, 41, 58, 77, 100, 129, 160, 197, 238, 281, 328, 381, 440, 501, 568, 639, 712, 791, 874, 963, 1060, 1161, 1264, 1371, 1480, 1593, 1720, 1851, 1988, 2127, 2276, 2427, 2584, 2747, 2914, 3087, 3266, 3447, 3638, 3831, 4028, 4227, 4438, 4661, 4888
Offset: 0

Views

Author

Keywords

Comments

It appears that a(n)^2 - a(n-1)^2 = A034960(n). - Gary Detlefs, Dec 20 2011
This is true. Proof: By definition we have A034960(n) = Sum_{k = (a(n-1)+1)..a(n)} (2*k-1). Since Sum_{k = 1..n} (2*k-1) = n^2, it follows A034960(n) = a(n)^2 - a(n-1)^2, for n > 1. - Hieronymus Fischer, Sep 27 2012 [formulas above adjusted to changed offset of A034960 - Hieronymus Fischer, Oct 14 2012]
Row sums of the triangle in A037126. - Reinhard Zumkeller, Oct 01 2012
Ramanujan noticed the apparent identity between the prime parts partition numbers A000607 and the expansion of Sum_{k >= 0} x^a(k)/((1-x)...(1-x^k)), cf. A046676. See A192541 for the difference between the two. - M. F. Hasler, Mar 05 2014
For n > 0: row 1 in A254858. - Reinhard Zumkeller, Feb 08 2015
a(n) is the smallest number that can be partitioned into n distinct primes. - Alonso del Arte, May 30 2017
For a(n) < m < a(n+1), n > 0, at least one m is a perfect square.
Proof: For n = 1, 2, ..., 6, the proposition is clear. For n > 6, a(n) < ((prime(n) - 1)/2)^2, set (k - 1)^2 <= a(n) < k^2 < ((prime(n) + 1)/2)^2, then k^2 < (k - 1)^2 + prime(n) <= a(n) + prime(n) = a(n+1), so m = k^2 is this perfect square. - Jinyuan Wang, Oct 04 2018
For n >= 5 we have a(n) < ((prime(n)+1)/2)^2. This can be shown by noting that ((prime(n)+1)/2)^2 - ((prime(n-1)+1)/2)^2 - prime(n) = (prime(n)+prime(n-1))*(prime(n)-prime(n-1)-2)/4 >= 0. - Jianing Song, Nov 13 2022
Washington gives an oscillation formula for |a(n) - pi(n^2)|, see links. - Charles R Greathouse IV, Dec 07 2022

References

  • E. Bach and J. Shallit, §2.7 in Algorithmic Number Theory, Vol. 1: Efficient Algorithms, MIT Press, Cambridge, MA, 1996.
  • H. L. Nelson, "Prime Sums", J. Rec. Math., 14 (1981), 205-206.
  • N. J. A. Sloane and Simon Plouffe, The Encyclopedia of Integer Sequences, Academic Press, 1995 (includes this sequence).

Crossrefs

See A122989 for the value of Sum_{n >= 1} 1/a(n).

Programs

  • GAP
    P:=Filtered([1..250],IsPrime);;
    a:=Concatenation([0],List([1..Length(P)],i->Sum([1..i],k->P[k]))); # Muniru A Asiru, Oct 07 2018
    
  • Haskell
    a007504 n = a007504_list !! n
    a007504_list = scanl (+) 0 a000040_list
    -- Reinhard Zumkeller, Oct 01 2014, Oct 03 2011
    
  • Magma
    [0] cat [&+[ NthPrime(k): k in [1..n]]: n in [1..50]]; // Bruno Berselli, Apr 11 2011 (adapted by Vincenzo Librandi, Nov 27 2015 after Hasler's change on Mar 05 2014)
    
  • Maple
    s1:=[2]; for n from 2 to 1000 do s1:=[op(s1),s1[n-1]+ithprime(n)]; od: s1;
    A007504 := proc(n)
        add(ithprime(i), i=1..n) ;
    end proc: # R. J. Mathar, Sep 20 2015
  • Mathematica
    Accumulate[Prime[Range[100]]] (* Zak Seidov, Apr 10 2011 *)
    primeRunSum = 0; Table[primeRunSum = primeRunSum + Prime[k], {k, 100}] (* Zak Seidov, Apr 16 2011 *)
  • PARI
    A007504(n) = sum(k=1,n,prime(k)) \\ Michael B. Porter, Feb 26 2010
    
  • PARI
    a(n) = vecsum(primes(n)); \\ Michel Marcus, Feb 06 2021
    
  • Python
    from itertools import accumulate, count, islice
    from sympy import prime
    def A007504_gen(): return accumulate(prime(n) if n > 0 else 0 for n in count(0))
    A007504_list = list(islice(A007504_gen(),20)) # Chai Wah Wu, Feb 23 2022

Formula

a(n) ~ n^2 * log(n) / 2. - Ahmed Fares (ahmedfares(AT)my-deja.com), Apr 24 2001 (see Bach & Shallit 1996)
a(n) = A014284(n+1) - 1. - Jaroslav Krizek, Aug 19 2009
a(n+1) - a(n) = A000040(n+1). - Jaroslav Krizek, Aug 19 2009
a(A051838(n)) = A002110(A051838(n)) / A116536(n). - Reinhard Zumkeller, Oct 03 2011
a(n) = min(A068873(n), A073619(n)) for n > 1. - Jonathan Sondow, Jul 10 2012
a(n) = A033286(n) - A152535(n). - Omar E. Pol, Aug 09 2012
For n >= 3, a(n) >= (n-1)^2 * (log(n-1) - 1/2)/2 and a(n) <= n*(n+1)*(log(n) + log(log(n))+ 1)/2. Thus a(n) = n^2 * log(n) / 2 + O(n^2*log(log(n))). It is more precise than in Fares's comment. - Vladimir Shevelev, Aug 01 2013
a(n) = (n^2/2)*(log n + log log n - 3/2 + (log log n - 3)/log n + (2 (log log n)^2 - 14 log log n + 27)/(4 log^2 n) + O((log log n/log n)^3)) [Sinha]. - Charles R Greathouse IV, Jun 11 2015
G.f: (x*b(x))/(1-x), where b(x) is the g.f. of A000040. - Mario C. Enriquez, Dec 10 2016
a(n) = A008472(A002110(n)), for n > 0. - Michel Marcus, Jul 16 2020

Extensions

More terms from Stefan Steinerberger, Apr 11 2006
a(0) = 0 prepended by M. F. Hasler, Mar 05 2014

A103208 Numbers k such that 3 divides prime(1) + ... + prime(k).

Original entry on oeis.org

10, 16, 18, 20, 24, 26, 28, 30, 32, 34, 36, 40, 42, 44, 46, 52, 54, 57, 68, 70, 74, 76, 78, 80, 82, 84, 86, 88, 90, 97, 99, 103, 105, 107, 111, 113, 119, 121, 123, 125, 127, 129, 134, 136, 138, 161, 163, 166, 169, 175, 177, 179, 185, 187, 195, 197, 199, 203, 205, 207, 211, 213
Offset: 1

Views

Author

Robert G. Wilson v, Mar 19 2005

Keywords

Comments

Also, numbers k such that 3 divides the concatenation of the first k primes (see A019518).
The first comment and the description are true whenever the number of primes congruent to 1 mod 6 exceeds the number of primes congruent to 5 mod 6 and the difference is congruent to 1 mod 3 or the number of primes congruent to 5 mod 6 exceeds the number of primes congruent to 1 mod 6 and the difference is congruent to 2 mod 3. - Roderick MacPhee, Oct 30 2015

Crossrefs

Programs

  • Maple
    s1:=[2]; M:=1000; for n from 2 to M do s1:=[op(s1),s1[n-1]+ithprime(n)]; od: s1;
    f:=proc(k) global M,s1; local t1,n; t1:=[]; for n from 1 to M do if s1[n] mod k = 0 then t1:=[op(t1),n]; fi; od: t1; end; f(3);
  • Mathematica
    f[n_] := FromDigits[ Flatten[ Table[ IntegerDigits[ Prime[i]], {i, n}]]]; Select[ Range[ 206], Mod[f[ # ], 3] == 0 &]
    Flatten[Position[Accumulate[Prime[Range[250]]],?(Divisible[#,3]&)]] (* _Harvey P. Dale, Jan 14 2016 *)
  • PARI
    a=0;b=0;for(x=3,1000,if(prime(x)%6==1,a+=1,b+=1);if((a-b)%3==1 || (b-a)%3==2,print1(x","))) \\ Roderick MacPhee, Oct 30 2015
    
  • PARI
    lista(nn) = { s=0; for(k=1, nn, s += prime(k); if(s % 3 == 0, print1(k, ", ")););} \\ Altug Alkan, Dec 04 2015

Extensions

Entry revised by N. J. A. Sloane, Nov 09 2005

A053050 a(n) = smallest integer m such that Sum_{k=1..m} prime(k) is divisible by n.

Original entry on oeis.org

1, 1, 10, 5, 2, 57, 5, 11, 20, 3, 8, 97, 49, 5, 57, 11, 4, 113, 23, 9, 40, 17, 23, 99, 9, 49, 26, 5, 7, 57, 39, 11, 76, 13, 180, 119, 29, 23, 119, 11, 6, 305, 10, 17, 242, 23, 39, 119, 40, 9, 179, 49, 25, 187, 17, 115, 70, 7, 30, 103, 151, 39, 40, 171, 131, 175, 38, 37, 52, 209, 19
Offset: 1

Views

Author

Felice Russo, Feb 25 2000

Keywords

Comments

It follows from a theorem of Daniel Shiu that m always exists. See A111287 for details. - N. J. A. Sloane, Nov 05 2005

References

  • Felice Russo, A set of new Smarandache functions, sequences and conjectures in number theory, American Research Press 2000

Crossrefs

Programs

  • Haskell
    a053050 n = head [k | (k, x) <- zip [1..] a007504_list, mod x n == 0]
    -- Reinhard Zumkeller, Oct 04 2015, Feb 10 2012
  • Maple
    read transforms; M:=1000; p0:=[seq(ithprime(i),i=1..M)]; q0:=PSUM(p0); w:=[]; for n from 1 to M do p:=n; hit := 0; for i from 1 to M do if q0[i] mod p = 0 then w:=[op(w),i]; hit:=1; break; fi; od: if hit = 0 then break; fi; od: w;
  • Mathematica
    Transpose[With[{aprs=Thread[{Range[500],Accumulate[Prime[Range[ 500]]]}]}, Flatten[Table[ Select[ aprs,Divisible[Last[#],n]&,1],{n,80}],1]]][[1]] (* Harvey P. Dale, Dec 14 2011 *)

Formula

A007504(a(n))/n = A308749(n). - Alois P. Heinz, Jun 21 2019

Extensions

More terms from N. J. A. Sloane, Nov 05 2005

A111272 Where n-th prime occurs in A111267.

Original entry on oeis.org

3, 10, 2, 8, 17, 49, 4, 23, 41, 7, 39, 29, 6, 50, 79, 121, 30, 151, 38, 19, 267, 48, 174, 21, 287, 422, 240, 24, 94, 22, 16, 215, 861, 231, 143, 140, 396, 902, 18, 134, 340, 310, 269, 58, 12, 550, 479, 210, 229, 612, 221, 271, 194, 540, 145, 718, 168, 184, 90, 14, 272
Offset: 1

Views

Author

N. J. A. Sloane, Nov 03 2005

Keywords

Crossrefs

Programs

  • Maple
    A111267 := proc(nmin) local a,k,qn,dvs; a := [1] ; qn := 5 ; while nops(a) < nmin do dvs := sort([op(numtheory[divisors](qn))]) ; for k from 1 to nops(dvs) do if not dvs[k] in a then a := [op(a),dvs[k]] ; qn := qn+ithprime(nops(a)+1) ; break ; fi ; od ; od; RETURN(a) ; end: A111272 := proc(nmin) local a,a111267,n,i; a := [] ; a111267 := A111267(nmin) ; n := 1; while member( ithprime(n),a111267,'i') do a := [op(a),i] ; n := n+1 ; od; RETURN(a) ; end: A111272(1000) ; # R. J. Mathar, Aug 20 2007

Extensions

More terms from R. J. Mathar, Aug 20 2007

A167790 a(n) is the index k of k-th prime prime(k) in the smallest sum s(k)=2+3+...+prime(k)=t*prime(n) of first k primes where t is a true divisor and first occurrence of factor prime(n) (n=1,2,3,...)

Original entry on oeis.org

3, 10, 3, 5, 8, 49, 13, 23, 23, 7, 39, 29, 15, 10, 39, 25, 30, 151, 38, 19, 139, 27, 174, 21, 287, 422, 240, 24, 94, 22, 16, 173, 861, 231, 143, 140, 213, 902, 18, 134, 143, 310, 70, 58, 295, 550, 237, 210, 229, 57, 221, 271, 194, 540, 145, 718, 116, 184, 90, 71, 168
Offset: 1

Views

Author

Eva-Maria Zschorn (e-m.zschorn(AT)zaschendorf.km3.de), Nov 12 2009, Nov 13 2009

Keywords

Comments

It is conjectured that the sequence is infinite
If t is not restricted to nontrivial divisors, the sequence becomes A111287. - R. J. Mathar, Nov 17 2009

Examples

			s(5)=2+3+5+7+11=28=2^2*7=4*prime(4) gives a(4)=5 as first occurrence of prime factor prime(4)=7;
s(8)=2+3+5+7+11+13+17+19=77=7*11=7*prime(5) gives a(5)=8 as first occurrence of prime factor prime(5)=11;
s(422)=2+3+5+...+2917=570145= 5 * 101 * 1129=5645*prime(26) gives a(26)=422 and demonstrates the numerical difficulties.
		

References

  • Richard E. Crandall and Carl Pomerance, Prime Numbers, Springer 2005
  • Leonard E. Dickson, History of the Theory of numbers, vol. I, Dover Publications 2005
  • Paulo Ribenboim, The New Book of Prime Number Records, Springer 1996

Crossrefs

Cf. A007504 (sum of first n primes).
Cf. A167764.

Formula

a(n) = min[2+3+...+prime(k)/t], where the minimum is taken with respect to k, the denominator t > 1 is an integer divisor of numerator s(k)=2+3+...+prime(k).

Extensions

Extended by R. J. Mathar, Nov 17 2009

A168678 Least prime p such that the prime(n)-1 consecutive primes starting at p are all congruent to 1 (mod prime(n)).

Original entry on oeis.org

3, 31, 22501, 9984437
Offset: 1

Views

Author

T. D. Noe, Dec 02 2009

Keywords

Comments

By a theorem of Shiu, a(n) exists for all n.

Crossrefs

Cf. A111287.

Programs

  • Mathematica
    Table[p=Prime[n]; cnt=0; q=2; While[q=NextPrime[q]; If[Mod[q,p]==1, cnt++, cnt=0]; cnt
    				
  • PARI
    A168678(n) = {local(p,m,c,r);p=2;r=2;m=prime(n);c=0;while(cMichael B. Porter, Feb 02 2010

A123119 Number of digits in sum of first n primes (A007504).

Original entry on oeis.org

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

Views

Author

Jonathan Vos Post, Sep 28 2006

Keywords

Comments

Since A007504(n) has the asymptotic expression ~ n^2 * log(n) / 2, a(n) has the asymptotic expression n^2 * log(n) / 2 = floor(log_10(10* n^2 * log(n) / 2)) = floor(log_10(5* n^2 * log(n))) = floor(log_10(5) + log_10(n^2) + log_10(log(n))) = floor(0.698970004 + 2*log_10(n) + log_10(log(n))). What is the smallest n such that a(n) = 5, 6, 7, ...?

Examples

			a(3) = 2 because 2 + 3 + 5 = 10 has 2 digits in its decimal expansion.
		

Crossrefs

Programs

  • Mathematica
    f[n_] := Floor[ Log[10, Sum[Prime@i, {i, n}]] + 1]; Array[f, 105] (* Robert G. Wilson v *)
    f[n_] := IntegerLength[Total[Prime[Range[n]]]]; Array[f, 105] (* Jan Mangaldan, Jan 04 2017 *)
    IntegerLength/@Accumulate[Prime[Range[110]]] (* Harvey P. Dale, Jan 26 2019 *)

Formula

a(n) = A055642(A007504(n)) = floor(log_10(10*A007504(n))) = A004216(A007504(n)) + 1 = A004218(A007504(n) + 1).

Extensions

More terms from Robert G. Wilson v, Oct 05 2006
Showing 1-7 of 7 results.