mersenneforum.org

mersenneforum.org (https://www.mersenneforum.org/index.php)
-   Puzzles (https://www.mersenneforum.org/forumdisplay.php?f=18)
-   -   "Prime Rewards" Credit Card (https://www.mersenneforum.org/showthread.php?t=14931)

cheesehead 2011-01-22 23:22

[QUOTE=davar55;248532]I may have to look in the stores for it.[/QUOTE][B]First, read this from Uncwilly in the "Bargain Hardware Thread" for an online significantly-discounted [/B](until Feb. 15)[B] dealer:[/B]

[QUOTE=Uncwilly;246474]This is a sort of 'bargain hardware':

KNUTH
[URL]http://www.informit.com/promotions/promotion.aspx?promo=138111[/URL]
The Art of Computer Programming Volume 4A and Updated Box Set

Art of Computer Programming, Volume 4A, The: Combinatorial Algorithms, Part 1 $48.74

Art of Computer Programming, Volumes 1-4A Boxed Set, The, 3rd Edition $162.49[/QUOTE]I got mine from them in less than a week.

davar55 2011-01-23 00:11

[QUOTE=cheesehead;248536][B]First, read this from Uncwilly in the "Bargain Hardware Thread" for an online significantly-discounted [/B](until Feb. 15)[B] dealer:[/B]

I got mine from them in less than a week.[/QUOTE]

OK Thank you. I've ordered it.

Have waited many years for this volume, haven't we.

cheesehead 2011-01-23 00:34

[QUOTE=davar55;248547]Have waited many years for this volume, haven't we.[/QUOTE]Yes, although one could have ordered "beta-test form" fascicles 0-4 in 2005-2009. [url]http://www-cs-faculty.stanford.edu/~uno/taocp.html[/url]

science_man_88 2011-01-23 01:09

[CODE](20:10)>[COLOR="Red"]b=0;forprime(x=1,10^8-1,if(isprime(x%(10^4)),for(y=0,10^(8-length(Str(x)))-1,if(isprime(10^(8-length(Str(x)))*y+x) && luhn(10^(8-length(Str(x)))*y+[/COLOR]
911500
(20:30)>##
*** last result computed in 19mn, 15,797 ms.[/CODE]

I colored the code red because it wasn't completely copied (mainly because it was so long). Can you confirm this result lavalamp ?

lavalamp 2011-01-23 01:46

It isn't obvious to me what you did. Can you explain what it did and post the whole code?

By the way, rather than type it out every time, you really should just write it in a text file and read it in with a command like:
\r C:\my\pari\code.txt

Also, for ease of reading, enclosing blocks of code inside {} allows you to use line breaks within if statements and for loops and such to spread the code out and indent it.

CRGreathouse 2011-01-23 01:50

[QUOTE=lavalamp;248579]By the way, rather than type it out every time, you really should just write it in a text file and read it in with a command like:
\r C:\my\pari\code.txt

Also, for ease of reading, enclosing blocks of code inside {} allows you to use line breaks within if statements and for loops and such to spread the code out and indent it.[/QUOTE]

:goodposting:

science_man_88 2011-01-23 02:19

[QUOTE=CRGreathouse;248581]:goodposting:[/QUOTE]

I do have a code.gp in fact with all the power outages due to storm / restarting I've been thinking of trying to code a autosave feature but unless it allows the command prompt to show through it can't do it in a way i know how to. I'll gladly give you the code but really it's just a alteration of the code I posted in post 50 and the luhn code is in 52.

[CODE]luhn(x)= w=eval(Vec(Str(x)));a=0;if(#w%2==1,for(i=1,#w,if(i%2==0,a=a+(2*w[i]),a=a+w[i])),for(i=1,#w,if(i%2==1,a=a+(2*w[i]),a=a+w[i])));if(a%10==0,return(1),return(0))[/CODE]

[CODE]b=0;forprime(x=1,10^8-1,if(isprime(x%(10^4)),for(y=1,10^(8-length(Str(x)))-1,if(isprime(10^(8-length(Str(x)))*y+x) && luhn(10^(8-length(Str(x)))*y+x),b=b+1))));print(b)[/CODE]

would you like the fancy version ?

CRGreathouse 2011-01-23 02:26

[QUOTE=science_man_88;248588]would you like the fancy version ?[/QUOTE]

I think in general you should always post the cleaned-up version (line breaks, comments, addhelp, etc.) version when you have it.

ixfd64 2011-01-23 02:33

[QUOTE=Uncwilly;247851]"[FONT="Book Antiqua"][B][SIZE="3"]MersenneForum fully funded through 2197[/SIZE][/B][/FONT]."[/QUOTE]

"Man who donated to Internet math forum charged with fraud"

lavalamp 2011-01-23 02:45

1 Attachment(s)
I asked you to explain what the code does. I have absolutely no idea what it could be.

What's all this 10^(8-length(Str(x)) business? All it does is add progressively smaller amounts to x as x itself increases. When x hits 8 digits, you have an inner loop that doesn't even run!

As for how to use pari, I've attached a screen shot. As you can see, I use notepad, but you can use any editor you like. Notepad++ is a free editor for which there is an autosave plugin.

science_man_88 2011-01-23 12:09

[QUOTE=lavalamp;248598]I asked you to explain what the code does. I have absolutely no idea what it could be.

What's all this 10^(8-length(Str(x)) business? All it does is add progressively smaller amounts to x as x itself increases. When x hits 8 digits, you have an inner loop that doesn't even run!

As for how to use pari, I've attached a screen shot. As you can see, I use notepad, but you can use any editor you like. Notepad++ is a free editor for which there is an autosave plugin.[/QUOTE]

exactly it I made it only go to eight digits to save time and figure out the number of 8 digit numbers that could fit some if not all can be extended to the 16 digit numbers , in other words I made a script to figure exactly how many elements A has.


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

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