A133784 Positive integers n such that the sum of all primes <= n divides n(n+1)/2.
4, 21, 24, 71
Offset: 1
Keywords
Examples
n=21 is in this sequence since the sum of the primes <=21 is 2+3+5+7+11+13+17+19=77 and 77 divides 21*22/2=231.
Programs
-
Maple
P:=proc(n) local i,snp,sp; snp:=1; sp:=2; for i from 3 by 1 to n do if isprime(i) then sp:=sp+i; else snp:=snp+i; fi; if trunc(snp/sp)=snp/sp then print(i); fi; od; end: P(10000000);
-
Mathematica
Select[Range[2,100],Divisible[(#(#+1))/2,Total[Prime[Range[ PrimePi[ #]]]]]&] (* Harvey P. Dale, May 31 2012 *)
-
PARI
A=1;P=0;for(n=2,1e9,A+=n;P+=isprime(n)*n;if(A%P==0,print1(n", "))) \\ Charles R Greathouse IV, Mar 21 2013
Extensions
Edited by Max Alekseyev, Feb 13 2009
Comments