![]() |
|
|
#78 | |
|
"Ben"
Feb 2007
DB916 Posts |
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. |
|
|
|
|
|
|
#79 |
|
"Forget I exist"
Jul 2009
Dumbassville
26×131 Posts |
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.
|
|
|
|
|
|
#80 |
|
"Forget I exist"
Jul 2009
Dumbassville
26·131 Posts |
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 ?
|
|
|
|
|
|
#81 |
|
"Forget I exist"
Jul 2009
Dumbassville
26·131 Posts |
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 |
|
|
|
|
|
#82 |
|
"Ben"
Feb 2007
3·1,171 Posts |
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 |
|
|
|
|
|
#83 |
|
"Ben"
Feb 2007
1101101110012 Posts |
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 |
|
|
|
|
|
#84 |
|
"Forget I exist"
Jul 2009
Dumbassville
26·131 Posts |
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 |
|
|
|
|
|
#85 |
|
"Forget I exist"
Jul 2009
Dumbassville
26·131 Posts |
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 ?
|
|
|
|
|
|
#86 |
|
"Ben"
Feb 2007
3·1,171 Posts |
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.
|
|
|
|
|
|
#87 |
|
"Forget I exist"
Jul 2009
Dumbassville
26×131 Posts |
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 |
|
|
|
|
|
#88 |
|
"Ben"
Feb 2007
3×1,171 Posts |
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.
|
|
|
|
![]() |
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 |