mersenneforum.org (https://www.mersenneforum.org/index.php)
-   Puzzles (https://www.mersenneforum.org/forumdisplay.php?f=18)
-   -   Sums of all Squares (https://www.mersenneforum.org/showthread.php?t=13181)

 davar55 2010-03-18 14:00

Sums of all Squares

2^2 + 3^2 + 5^2 + ... + p^2 = 10[sup]m[/sup]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).

 axn 2010-03-18 14:26

[SPOILER]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[/SPOILER]

 davar55 2010-03-18 14:32

Nice and simple and quick reply -- thanks.

 CRGreathouse 2010-03-18 17:11

907, 977, 977, 36643, 1067749, 17777197, 71622461, 2389799983, ...

The next term (if one exists) is more than 4 trillion.

Not yet in the OEIS.

[URL="http://www.research.att.com/%7Enjas/sequences/"]http://www.research.att.com/~njas/sequences/[/URL]

[quote]Search: [B]907,[/B] [spoiler][B] 967, 977, 991[/B] [/spoiler]

I am sorry, but the terms do not match anything in the table.

If your sequence is of general interest, please send it to me using the [URL="http://www.research.att.com/%7Enjas/sequences/Submit.html"]form provided[/URL] and I will (probably) add it to the data base! Include a brief description and if possible enough terms to fill 3 lines on the screen. I need a minimum of 4 terms.[/quote]I think it qualifies. Also, I'm fond of OEIS entries with relatively large initial terms -- especially when the next few terms are so closely spaced as in this one. (Might it set some record in that regard -- highest ratio of initial term to average spacing of next n terms, for n = 3?)

I'd be glad to submit it, but I think it should be one of you guys.

How about generalizing to other bases?

 axn 2010-03-18 19:02

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).

[quote=axn;208810]I think CRG's sequence is more "worthy".[/quote][spoiler]Even with the omitted and repeated (just a typo) terms? :smile:[/spoiler]

What I had in mind was a submission with the best of both your contributions.

[quote]I can think of two ways to generalize: to other bases and other powers (other than squares).[/quote]Oh, wow ... bases 2-16 or so, powers to, say, ninth ==> 135 sequences.

 axn 2010-03-18 19:59

[QUOTE=cheesehead;208818]Even with the omitted and repeated terms?[/QUOTE]
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

[quote=axn;208819]That sequence is the first occurrence of 10^n. 977 repeats because it ends in 000 and comes before any other 00. So it stands at positions 2 & 3.[/quote]:doh!:

(Sorry, CRG)

But that doubles the potential number of sequences. 270.

 CRGreathouse 2010-03-19 01:28

[QUOTE=CRGreathouse;208783]The next term (if one exists) is more than 4 trillion.[/QUOTE]

:blush: 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...

 bsquared 2010-03-29 16:42

[QUOTE=CRGreathouse;208849] Anyone up to the task? I don't actually have a good segmented sieve coded at the moment...[/QUOTE]

I bit. :smile:

I have [url=http://www.mersenneforum.org/showpost.php?p=209641&postcount=359]recently[/url] 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
[/CODE]

With these timing trends, should have a result in 7 hours or so.

- ben.

All times are UTC. The time now is 07:54.