20100318, 14:00  #1 
May 2004
New York City
2·2,099 Posts 
Sums of all Squares
2^2 + 3^2 + 5^2 + ... + p^2 = 10^{m}K
What is the smallest prime p such that the sum of squares of all primes up to p is a multiple of 10 (or 100 or 1000). 
20100318, 14:26  #2 
Jun 2003
2^{2}·11·107 Posts 
s=0;forprime(p=2,1000,s=s+p^2;if(Mod(s,10)==0, print(p, ":",s)))
907:37464550 967:44505630 977:46403000 991:48351370 
20100318, 14:32  #3 
May 2004
New York City
2×2,099 Posts 
Nice and simple and quick reply  thanks.
I won't ask about extending the list to 10000, etc. ..... 
20100318, 17:11  #4 
Aug 2006
2·2,963 Posts 
907, 977, 977, 36643, 1067749, 17777197, 71622461, 2389799983, ...
The next term (if one exists) is more than 4 trillion. Last fiddled with by CRGreathouse on 20100318 at 17:20 
20100318, 18:16  #5  
"Richard B. Woods"
Aug 2002
Wisconsin USA
1110000010100_{2} Posts 
Not yet in the OEIS.
http://www.research.att.com/~njas/sequences/ Quote:
I'd be glad to submit it, but I think it should be one of you guys. How about generalizing to other bases? Last fiddled with by cheesehead on 20100318 at 18:34 

20100318, 19:02  #6 
Jun 2003
2^{2}·11·107 Posts 
I think CRG's sequence is more "worthy". It is also the solution of OP.
I can think of two ways to generalize: to other bases and other powers (other than squares). 
20100318, 19:50  #7  
"Richard B. Woods"
Aug 2002
Wisconsin USA
2^{2}·3·599 Posts 
Even with the omitted and repeated (just a typo) terms? :smile:
What I had in mind was a submission with the best of both your contributions. Quote:
Last fiddled with by cheesehead on 20100318 at 19:56 

20100318, 19:59  #8 
Jun 2003
2^{2}·11·107 Posts 
That sequence is the first occurrence of 10^n. 977 repeats (not a typo!) because it ends in 000 and comes before any other 00. So it stands at positions 2 & 3.
EDIT: Mine is merely the first four occurrences of 10 Last fiddled with by axn on 20100318 at 20:02 
20100318, 20:02  #9  
"Richard B. Woods"
Aug 2002
Wisconsin USA
2^{2}·3·599 Posts 
Quote:
(Sorry, CRG) But that doubles the potential number of sequences. 270. Last fiddled with by cheesehead on 20100318 at 20:04 

20100319, 01:28  #10 
Aug 2006
2·2,963 Posts 
That's *billion*, not trillion. Now my search limit is 50 billion, giving me
907, 977, 977, 36643, 1067749, 17777197, 71622461, 2389799983, 31252968359, 49460594569, ... The nth term is very roughly n * log 10 * 10^n, so I was pretty lucky getting that last term. The next one will probably need over 2 trillion. Anyone up to the task? I don't actually have a good segmented sieve coded at the moment... 
20100329, 16:42  #11  
"Ben"
Feb 2007
5·659 Posts 
Quote:
I have recently spent some time with my sieve, so decided to give this a shot. I just started a run to 2 trillion. Here is the output so far: Code:
found primes in range 0 to 1000000000 in elapsed time = 7.0227 **** 907 is 0 mod 10 **** **** 977 is 0 mod 100 **** **** 977 is 0 mod 1000 **** **** 36643 is 0 mod 10000 **** **** 1067749 is 0 mod 100000 **** **** 17777197 is 0 mod 1000000 **** **** 71622461 is 0 mod 10000000 **** sum of squares complete in elapsed time = 8.5178, sum is 16352255694497179054764665 found primes in range 1000000000 to 2000000000 in elapsed time = 5.9418 sum of squares complete in elapsed time = 7.9423, sum is 126512354351558021982865866 found primes in range 2000000000 to 3000000000 in elapsed time = 5.9503 **** 2389799983 is 0 mod 100000000 **** sum of squares complete in elapsed time = 7.7389, sum is 418923904898718760122282892 found primes in range 3000000000 to 4000000000 in elapsed time = 5.8990 sum of squares complete in elapsed time = 7.6150, sum is 979895993641271252685833855 found primes in range 4000000000 to 5000000000 in elapsed time = 5.8293 sum of squares complete in elapsed time = 7.4966, sum is 1894402266333772221759233898  ben. 

Thread Tools  
Similar Threads  
Thread  Thread Starter  Forum  Replies  Last Post 
Regarding Squares  a1call  Miscellaneous Math  42  20170203 01:29 
Basic Number Theory 12: sums of two squares  Nick  Number Theory Discussion Group  0  20161211 11:30 
Integers = sums of 2s and 3s.  3.14159  Miscellaneous Math  12  20100721 11:47 
Sums of three squares  CRGreathouse  Math  6  20091106 19:20 
squares or not squares  m_f_h  Puzzles  45  20070615 17:46 