Patience

User avatar
lechat
Posts: 12
Joined: Wed Feb 27, 2008 10:16 am

Patience

Post by lechat »

Hi adum!

I liked you Patience Challenge!
I could really sit back and relax for... For how long exactly? ;-) My estimate is 8 years give or take :-) :-) :-)

...This would really be THE CHALLENGE!!!
User avatar
adum
Posts: 392
Joined: Thu Apr 19, 2007 12:49 pm
Contact:

Post by adum »

=)
the_impaler
Posts: 61
Joined: Wed Apr 30, 2008 3:31 am

Post by the_impaler »

There are only 2 options left then :
- use the future Java version (the one that used in "Portal to the Future")
- make gerbils to spin the wheel faster
User avatar
lechat
Posts: 12
Joined: Wed Feb 27, 2008 10:16 am

Post by lechat »

Oh! Great! :-)
Thank you for the hint about Portal to the Future! :-) :-) :-)
I solved it! :lol:
michuber
Posts: 57
Joined: Sun Oct 26, 2008 3:30 pm

Post by michuber »

Have i missed something?

I removed the time consuming line from the for loop and found many l's in seconds that would pass the while. But none of them is the correct answer.

Where am i wrong?
gfoot
Posts: 269
Joined: Wed Sep 05, 2007 11:34 pm
Location: Brighton, UK

Post by gfoot »

Me too. Do we need to find the particular one that would come out of the seeded RNG first?
MichaBln
Posts: 18
Joined: Tue Nov 11, 2008 1:55 pm
Location: Berlin, GER

Post by MichaBln »

Hi,

I solved that challenge by optimizing and thinking about what really is relevant for getting the right answer ... still it took a few mins till it printed out the right number ... so if it took just secondes and you didn't do more than taking away that slowing-down-lines inside the loop ... i guess something else is wrong.
michuber
Posts: 57
Joined: Sun Oct 26, 2008 3:30 pm

Post by michuber »

I found the last 5 digits xxxxx and tested xxxxx+i*100000. For i=111 the last 9 digits match (took 5 sec.). So this should be a correct answer... The first number from the RNG was i=7670024504486xxxxx, incorrect too...
MichaBln
Posts: 18
Joined: Tue Nov 11, 2008 1:55 pm
Location: Berlin, GER

Post by MichaBln »

Hi,

I don't really get why you test the numbers the way you do ... all i can tell you, that the correct number occurs much later in the sequence than i=111, MUCH later. I can't tell you how much later, that would spoil to much.

I don't understand what you are doing (but i guess alot of approaches might work here ... so your approach might be correct).

This is really about optimization, so keep the approach from the original and just speed it up.
Ok, here is one major hint: BigIntegers are very slow ... and you can solve this without them.

If anyone thinks that spoils to much just tell me and I'll edit that part out.
snibril
Posts: 31
Joined: Sun Oct 26, 2008 11:18 pm

Post by snibril »

If you speed up this than you get the answer after:
snibril@hera:~/hacker$ time java Patience
XXXXXXXXXXXXXXXX

real 0m0.546s
user 0m0.452s
sys 0m0.044s
homeas
Posts: 10
Joined: Thu Nov 13, 2008 11:17 pm

Post by homeas »

whoever uses J# from Microsoft (I do it for laziness with VS 2005 ...)

-- oh dear, he/she will get a completely different solution.

there is obviously no common RNG ...
gfoot
Posts: 269
Joined: Wed Sep 05, 2007 11:34 pm
Location: Brighton, UK

Post by gfoot »

The Java Random class is explicitly defined to use a certain algorithm, in order to assure repeatability of the generated sequences regardless of implementation or architecture. I'm not a Java expert, but I'd guess that if J# veers from the standard implementation then it's broken - maybe it provides a compatibility option though?

That said, maybe J# is documented as being based on a totally different implementation of the standard library. I dunno. I guess J# just isn't Java, in the same way that "managed" C++ is not C++.
megabreit
Posts: 141
Joined: Sat Jan 03, 2009 3:33 pm

Post by megabreit »

Erm... I don't get it... but from my point of view the solution is completely independent
from the RNG. The RNG defines just the starting point of each calculation.
One should find the same solution just by trying all possibilities with brute force...
although this would take "a bit" longer to computer.
nto
Posts: 6
Joined: Mon Nov 16, 2009 10:31 am

Post by nto »

megabreit wrote:Erm... I don't get it... but from my point of view the solution is completely independent
from the RNG. The RNG defines just the starting point of each calculation.
One should find the same solution just by trying all possibilities with brute force...
although this would take "a bit" longer to computer.
This would only be the case if there is exactly one number that satisfies the criteria.
KindeX
Posts: 2
Joined: Thu Jul 22, 2010 6:42 pm

Post by KindeX »

I think approximate every 1 000 000 000th number fits the criteria.
So the question is if the checker accepts only one predefined correct answer, or checks every every answer with some algorithm.
I've found many numbers that fits criteria, but site does not accept it.
Post Reply