mersenneforum.org

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)

bsquared 2010-04-07 00:34

[quote=petrw1;210798]Cool....my first 5 answers match.

Crap...I missed the next 2: Bug alert![/quote]

What program are you using? It's entirely possible the bug is in my code.

axn 2010-04-07 00:48

[QUOTE=bsquared;210804]What program are you using? It's entirely possible the bug is in my code.[/QUOTE]

Pari concurs with your first seven

[CODE]p=2;s=0;ten=10;for(i=2,10000000,s=s+p;if(Mod(s,ten)==0, ten=ten*10;print(i,":",p, ":",s)); p=nextprime(p+1))

4:5:10
10:23:100
3796:35677:63731000
10184:106853:515530000
51532:632501:15570900000
1926966:31190879:29057028000000
3471032:58369153:98078160000000[/CODE]

axn 2010-04-07 01:01

While we're at it, some results for the cubes:
[CODE]3:5:160
51:233:143309500
1095:8783:167992435025000
2739:24763:9495929161130000
401785:5828099:18803849605481106073200000
616801:9229931:114943299218925309364000000
14335805:262707241:62239590622437034770047320000000
[/CODE]

petrw1 2010-04-07 03:40

[QUOTE=bsquared;210804]What program are you using? It's entirely possible the bug is in my code.[/QUOTE]

Plain, ordinary, BASIC.

My guess is I lost precision when the sum got too high.
I need to try QuadIntegers

bsquared 2010-04-07 04:46

[QUOTE=axn;210806]While we're at it, some results for the cubes:
[CODE]3:5:160
51:233:143309500
1095:8783:167992435025000
2739:24763:9495929161130000
401785:5828099:18803849605481106073200000
616801:9229931:114943299218925309364000000
14335805:262707241:62239590622437034770047320000000
[/CODE][/QUOTE]

Doublecheck plus a few more:
[CODE]**** 10 divides prime cube sum up to 5, sum = 160 ****
**** 100 divides prime cube sum up to 233, sum = 143309500 ****
**** 1000 divides prime cube sum up to 8783, sum = 167992435025000 ****
**** 10000 divides prime cube sum up to 24763, sum = 9495929161130000 ****
**** 100000 divides prime cube sum up to 5828099, sum = 18803849605481106073200000 ****
**** 1000000 divides prime cube sum up to 9229931, sum = 114943299218925309364000000 ****
**** 10000000 divides prime cube sum up to 262707241, sum = 62239590622437034770047320000000 ****
**** 100000000 divides prime cube sum up to 7717488553, sum is 39389391603365585735745579849700000000 ****
**** 1000000000 divides prime cube sum up to 34529828929, sum = 14800565770732540706707662233175000000000 ****
**** 10000000000 divides prime cube sum up to 311995561321, sum = 90365528187658782254536155073531290000000000 ****

[/CODE]

By morning the search should be at (all primes below) 10 trillion.

bsquared 2010-04-07 14:08

[QUOTE=bsquared;210814]
By morning the search should be at (all primes below) 10 trillion.[/QUOTE]

Done. Here's the 11th term:

[CODE]**** 100000000000 divides prime cube sum up to 549120448879, sum is 848814744633978332442418792098769600000000000 ****[/CODE]

I updated my [URL="http://sites.google.com/site/bbuhrow/home/sums-of-prime-squares"]webpage [/URL]too.

bsquared 2010-04-07 14:17

[QUOTE=petrw1;210813]Plain, ordinary, BASIC.

My guess is I lost precision when the sum got too high.
I need to try QuadIntegers[/QUOTE]

Yes, that could be the issue. I'm using 3 64 bit words to hold the sum, which may not even be big enough for the cube sum problem eventually. 192 bits can hold a 58 digit number without loss of precision and the cube sum up to 10 trillion is already at 49 digits.

A single 64 bit integer runs out of precision at about 1.8e19, which is enough for the prime sum up to about 9 billion. Since you found the point at (632501 15570900000), you must be using more than 32 bits... but with 64 bits you should be fine for a few more points of the sequence. So maybe its an issue with your prime generation as well. A useful double check is to see if the count of primes you've summed agrees with known prime counts. For instance [URL="http://www.trnicely.net/pi/pix_0000.htm"]here[/URL].

petrw1 2010-04-07 17:34

YUP- precision.
 
[QUOTE=petrw1;210813]Plain, ordinary, BASIC.

My guess is I lost precision when the sum got too high.
I need to try QuadIntegers[/QUOTE]

I can match the first 7 now.

I used canned/downloaded lists of Primes.

Takes about 5 seconds.

davar55 2010-04-08 14:28

Another way to extend this problem is to use
a base other than ten. I think binary.

2^2 + 3^2 + 5^2 + ... + p^2 = 2[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 2 (or 4 or 8 or 16 or ...).

This question can also be asked of first powers
or cubes of primes.

Since we basically compute in decimal or binary,
if there's an interesting number theoretic fact here
we may find it in one of these two related
sequences of sequences.

cheesehead 2010-04-08 14:55

[quote=cheesehead;208818]Oh, wow ... bases 2-16 or so, powers to, say, ninth ==> 135 sequences.[/quote]...

alexhiggins732 2010-04-10 01:35

[quote=bsquared;210847]Done. Here's the 11th term:

[code]**** 100000000000 divides prime cube sum up to 549120448879, sum is 848814744633978332442418792098769600000000000 ****[/code]I updated my [URL="http://sites.google.com/site/bbuhrow/home/sums-of-prime-squares"]webpage [/URL]too.[/quote]

n Pmax Sum(P^2) from 2 to Pmax; a multiple of 10^n
1 907 37464550[B]
2[/B][B] 977[/B][B] 46403000[/B][B]
3[/B][B] 977[/B][B] 46403000[/B]

You have duplicated 2 and 3 on your site. I also noted that the OEIS sequence didn't have example code. Perhaps you could submit the expression you have entered into YAFU.


All times are UTC. The time now is 05:36.

Powered by vBulletin® Version 3.8.11
Copyright ©2000 - 2021, Jelsoft Enterprises Ltd.