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-20 15:53

[QUOTE=science_man_88;212580]

as to the code if i know what to help with I do have a ASM forum I have gone to maybe they could turn it to straight asm ( apparently ASM is now changed with different OS but if we can get it to a form that will work on most OS'es would that be worthy ?)[/QUOTE]

It sounds like you are offering to "help" by asking other people to do some work for you. Also it seems you are somewhat missing the point of this thread; it is a puzzle, not a DC project, and doesn't need any help per se. You are free to do what you like to try to solve the puzzle or one of the variants. If you decide to work on the sum of primes/squares/cubes mod 10^n, then I'd be grateful for any doublechecking you want to do, or you can extend the sequences using the .csv files from my website.

 science_man_88 2010-04-20 16:48

a=0;b=0;c=0;forprime(x=1,200,a=a+x;b=b+x^2;c=c+x^3;print(a","b","c)) is the best pari code I can see except forprime would need a bigger addprimes() to figure this out.

 science_man_88 2010-04-20 16:50

a=0;b=0;c=0;for(x=1,200,if(isprime(x),a=a+x;b=b+x^2;c=c+x^3;print(a","b","c))) is probably better actually can you turn this into assembly if you want an exe ?

 science_man_88 2010-04-20 16:54

to create the exponents without multiplying using counter variables and addition might speed it up.

 bsquared 2010-04-20 16:56

[QUOTE=science_man_88;212596]a=0;b=0;c=0;forprime(x=1,200,a=a+x;b=b+x^2;c=c+x^3;print(a","b","c)) is the best pari code I can see except forprime would need a bigger addprimes() to figure this out.[/QUOTE]

Well, you forgot to check for multiples of 10^n (or a different variant). Also, other people in this thread have already posted PARI code. Its a start though. Now just increase your upper bound by 12 orders of magnitude or so and you'll be up to the state of the art.

 bsquared 2010-04-20 17:00

[QUOTE=science_man_88;212599]to create the exponents without multiplying using counter variables and addition might speed it up.[/QUOTE]

Try this for a prime near 10e12 and say that again.

 science_man_88 2010-04-20 17:02

well log(x)/log(10) could fix the check but[B] I'm not smart enough[/B] to implement them in assembly I've tried to learn it before and to do that I'll probably need to redownload masm.

 science_man_88 2010-04-20 17:05

bsqaured couldn't you use data to have constant powers of 10 then negate to check if it's a multiple of a power of 10 ?

 bsquared 2010-04-20 17:12

[QUOTE=science_man_88;212604]bsqaured couldn't you use data to have constant powers of 10 then negate to check if it's a multiple of a power of 10 ?[/QUOTE]

I'm not sure I understand what you mean. If you're trying to ask if there are shortcuts to doing a full check (for a power of 10) every iteration then yes, there are. The code I posted earlier does a quick check using a single bit operation most of the time, and a full check using a single division occasionally, supported by a few variables.

 science_man_88 2010-04-20 17:18

for a given a could you do this type of thing for log at least:

a=10;b=10;for(counter=0,10,if(a>0,a=a-b));print(counter);

 bsquared 2010-04-20 17:21

[QUOTE=science_man_88;212603]well log(x)/log(10) could fix the check but[B] I'm not smart enough[/B] to implement them in assembly I've tried to learn it before and to do that I'll probably need to redownload masm.[/QUOTE]

Assembly isn't the final answer for speed. Given the quality of optimizing compilers and complex, pipelined, out-of-order cpus nowadays you are almost universally better off using a higher level language to get something done, and done fast enough.

All times are UTC. The time now is 08:27.