mersenneforum.org Sums of all Squares
 Register FAQ Search Today's Posts Mark Forums Read

2010-03-30, 17:27   #23
CRGreathouse

Aug 2006

173216 Posts

Quote:
 Originally Posted by bsquared I guess I was thinking of a link to tables, or something. But that would require me to generate and host those tables. I'll save that for some day when I'm bored ;)
Maybe you can submit a sequence of every millionth term or something. Not exactly classy, but it has precedent (A080128, say).

76304519151822049179, 671924965564646162227, 2393465488665494654963, 5889405149040404480379, 11834774513923727795971, 20925456417823033330259, ...

2010-03-30, 19:00   #24
bsquared

"Ben"
Feb 2007

1101000011012 Posts

Quote:
 Originally Posted by CRGreathouse Right. You could do two modili at a time without much penalty, though, with appropriate lookup tables and bit operations. Note that you only need to compare (and hence reduce) every 8 primes, each term (other than the first) has index = 5 (mod 8).
I just realized my code to do the sum of prime squares routines was hugely inefficient, in that I was using YAFU's built in arbitrary precision functions to do the squaring and summing. In reality we only need fixed precision of, say, 3 64 bit limbs (192 bits should be plenty to represent the sum). Implementing this made my sum of prime squares routine about 35 times faster.

I also store the highest power of 2 dividing the power of 10 modulus, which makes for a very quick pre-test of divisibility by 10 (logical AND followed by a predictable branch) and makes full precision divisions *extremely* rare. Doing things this way is actually faster than using pure modular arithmetic, since we almost never have to perform a division.

As a side benefit, it's easy to build tables of prime sums, or prime square sums, and we also don't have to restart a sum to test for a new power of 10 modulus.

2010-03-30, 19:02   #25
bsquared

"Ben"
Feb 2007

13·257 Posts

Quote:
 Originally Posted by CRGreathouse Not exactly classy ...
Right up my alley, then

 2010-03-30, 19:43 #26 bsquared     "Ben" Feb 2007 13·257 Posts I must have some sort of tinkerers disease... can't leave well enough alone. This disease was causing me to be offended by how long it was taking to compute the primes in a range of 1e9. So I tinkered... and doubled the speed before: Code: found 40609038 primes in range 49000000000 to 50000000000 in elapsed time = 5.4835 **** 49460594569 is 0 mod 1410065408 **** sum of squares complete in elapsed time = 6.8852, sum is 1714863031171407826702942323341 after: Code: found 40609038 primes in range 49000000000 to 50000000000 in elapsed time = 2.8866 **** 49460594569 is 0 mod 10000000000 **** sum of squares complete in elapsed time = 0.1639, sum is 1714863031171407826702942323341 which of course is completely useless, but now I feel better.
 2010-03-30, 20:00 #27 davar55     May 2004 New York City 2×2,099 Posts This is fine work by all of you. If you wish to submit the sequence to oeis, please go ahead. I couldn't do justice to the calculations, which I'm really impressed by. Joint discovery (attribution) is fine.
2010-03-30, 20:14   #28
CRGreathouse

Aug 2006

2·2,969 Posts

Quote:
 Originally Posted by davar55 I couldn't do justice to the calculations, which I'm really impressed by.
I'll echo this. I just used a one-line Pari script to discover mine.

 2010-04-02, 14:41 #29 bsquared     "Ben" Feb 2007 13·257 Posts Now in OEIS: A174862
 2010-04-06, 20:28 #30 davar55     May 2004 New York City 419810 Posts With all the work done on the OP, it shouldn't be too hard to generalize the problem a bit. I think cubes. 2^3 + 3^3 + 5^3 + ... + p^3 = 10mK What is the smallest prime p such that the sum of cubes of all primes up to p is a multiple of 10 (or 100 or 1000 or 10000 or ...). I'm also curious about how these (squares and cubes) results compare to first powers (sum of primes themselves). Since these series depend on the properties of a number in base ten, they could be considered recreational -- interesting but not necessarily useful. Still, perhaps the sequence of sequences can someday be used to derive some important number theoretic fact. That's one of the purposes of the oeis.
2010-04-06, 22:33   #31
petrw1
1976 Toyota Corona years forever!

"Wayne"
Nov 2006

4,457 Posts

Quote:
 Originally Posted by davar55 I'm also curious about how these (squares and cubes) results compare to first powers (sum of primes themselves).
A start on the first powers for the first 6,000,000 primes - p<=104,395,301

5 10
23 100
35677 63731000
106853 515530000
632501 15570900000

Last fiddled with by petrw1 on 2010-04-06 at 22:40 Reason: 6M

2010-04-06, 22:36   #32
bsquared

"Ben"
Feb 2007

1101000011012 Posts

Quote:
 Originally Posted by petrw1 A start on the first powers for the first 1,000,000 primes - p<=15,485,863 5 10 23 100 35677 63731000 106853 515530000 632501 15570900000
See here

2010-04-06, 22:44   #33
petrw1
1976 Toyota Corona years forever!

"Wayne"
Nov 2006

116916 Posts

Quote:
 Originally Posted by bsquared See here

Crap...I missed the next 2: Bug alert!

 Similar Threads Thread Thread Starter Forum Replies Last Post a1call Miscellaneous Math 42 2017-02-03 01:29 Nick Number Theory Discussion Group 0 2016-12-11 11:30 3.14159 Miscellaneous Math 12 2010-07-21 11:47 CRGreathouse Math 6 2009-11-06 19:20 m_f_h Puzzles 45 2007-06-15 17:46

All times are UTC. The time now is 15:55.

Tue Nov 24 15:55:11 UTC 2020 up 75 days, 13:06, 4 users, load averages: 1.24, 1.50, 1.67