mersenneforum.org  

Go Back   mersenneforum.org > Fun Stuff > Puzzles

Reply
 
Thread Tools
Old 2010-04-20, 15:53   #78
bsquared
 
bsquared's Avatar
 
"Ben"
Feb 2007

DB916 Posts
Default

Quote:
Originally Posted by science_man_88 View Post

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


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.
bsquared is offline   Reply With Quote
Old 2010-04-20, 16:48   #79
science_man_88
 
science_man_88's Avatar
 
"Forget I exist"
Jul 2009
Dumbassville

26×131 Posts
Default

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 is offline   Reply With Quote
Old 2010-04-20, 16:50   #80
science_man_88
 
science_man_88's Avatar
 
"Forget I exist"
Jul 2009
Dumbassville

26·131 Posts
Default

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 is offline   Reply With Quote
Old 2010-04-20, 16:54   #81
science_man_88
 
science_man_88's Avatar
 
"Forget I exist"
Jul 2009
Dumbassville

26·131 Posts
Default

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

Last fiddled with by science_man_88 on 2010-04-20 at 16:56
science_man_88 is offline   Reply With Quote
Old 2010-04-20, 16:56   #82
bsquared
 
bsquared's Avatar
 
"Ben"
Feb 2007

3·1,171 Posts
Default

Quote:
Originally Posted by science_man_88 View Post
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.
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.

Last fiddled with by bsquared on 2010-04-20 at 17:02 Reason: oversimilification
bsquared is offline   Reply With Quote
Old 2010-04-20, 17:00   #83
bsquared
 
bsquared's Avatar
 
"Ben"
Feb 2007

1101101110012 Posts
Default

Quote:
Originally Posted by science_man_88 View Post
to create the exponents without multiplying using counter variables and addition might speed it up.
Try this for a prime near 10e12 and say that again.

Last fiddled with by bsquared on 2010-04-20 at 17:02 Reason: oversimilification
bsquared is offline   Reply With Quote
Old 2010-04-20, 17:02   #84
science_man_88
 
science_man_88's Avatar
 
"Forget I exist"
Jul 2009
Dumbassville

26·131 Posts
Default

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

Last fiddled with by science_man_88 on 2010-04-20 at 17:03
science_man_88 is offline   Reply With Quote
Old 2010-04-20, 17:05   #85
science_man_88
 
science_man_88's Avatar
 
"Forget I exist"
Jul 2009
Dumbassville

26·131 Posts
Default

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 ?
science_man_88 is offline   Reply With Quote
Old 2010-04-20, 17:12   #86
bsquared
 
bsquared's Avatar
 
"Ben"
Feb 2007

3·1,171 Posts
Default

Quote:
Originally Posted by science_man_88 View Post
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 ?
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.
bsquared is offline   Reply With Quote
Old 2010-04-20, 17:18   #87
science_man_88
 
science_man_88's Avatar
 
"Forget I exist"
Jul 2009
Dumbassville

26×131 Posts
Default

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

Last fiddled with by science_man_88 on 2010-04-20 at 17:21
science_man_88 is offline   Reply With Quote
Old 2010-04-20, 17:21   #88
bsquared
 
bsquared's Avatar
 
"Ben"
Feb 2007

3×1,171 Posts
Default

Quote:
Originally Posted by science_man_88 View Post
well log(x)/log(10) could fix the check but I'm not smart enough to implement them in assembly I've tried to learn it before and to do that I'll probably need to redownload masm.
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.
bsquared is offline   Reply With Quote
Reply



Similar Threads
Thread Thread Starter Forum Replies Last Post
Regarding Squares a1call Miscellaneous Math 42 2017-02-03 01:29
Basic Number Theory 12: sums of two squares Nick Number Theory Discussion Group 0 2016-12-11 11:30
Integers = sums of 2s and 3s. 3.14159 Miscellaneous Math 12 2010-07-21 11:47
Sums of three squares CRGreathouse Math 6 2009-11-06 19:20
squares or not squares m_f_h Puzzles 45 2007-06-15 17:46

All times are UTC. The time now is 03:39.


Sat Jul 17 03:39:33 UTC 2021 up 50 days, 1:26, 1 user, load averages: 1.53, 1.62, 1.60

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

This forum has received and complied with 0 (zero) government requests for information.

Permission is granted to copy, distribute and/or modify this document under the terms of the GNU Free Documentation License, Version 1.2 or any later version published by the Free Software Foundation.
A copy of the license is included in the FAQ.