hacker.org Forum Index
RegisterSearchFAQMemberlistUsergroupsLog in
Patience
Goto page 1, 2  Next
 
Reply to topic    hacker.org Forum Index » Challenges View previous topic
View next topic
Patience
Author Message
lechat



Joined: 27 Feb 2008
Posts: 12

Post Patience Reply with quote
Hi adum!

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

...This would really be THE CHALLENGE!!!
Fri Sep 05, 2008 5:18 pm View user's profile Send private message
adum



Joined: 19 Apr 2007
Posts: 391

Post Reply with quote
=)
Fri Sep 05, 2008 5:26 pm View user's profile Send private message Visit poster's website
the_impaler



Joined: 30 Apr 2008
Posts: 61

Post Reply with quote
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
Sun Sep 07, 2008 1:09 am View user's profile Send private message
lechat



Joined: 27 Feb 2008
Posts: 12

Post Reply with quote
Oh! Great! Smile
Thank you for the hint about Portal to the Future! Smile Smile Smile
I solved it! Laughing
Sun Sep 07, 2008 7:34 pm View user's profile Send private message
michuber



Joined: 26 Oct 2008
Posts: 57

Post Reply with quote
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?
Mon Nov 24, 2008 7:29 am View user's profile Send private message
gfoot



Joined: 05 Sep 2007
Posts: 269
Location: Brighton, UK

Post Reply with quote
Me too. Do we need to find the particular one that would come out of the seeded RNG first?
Mon Nov 24, 2008 9:36 am View user's profile Send private message
MichaBln



Joined: 11 Nov 2008
Posts: 18
Location: Berlin, GER

Post Reply with quote
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.
Mon Nov 24, 2008 12:16 pm View user's profile Send private message
michuber



Joined: 26 Oct 2008
Posts: 57

Post Reply with quote
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...
Mon Nov 24, 2008 2:20 pm View user's profile Send private message
MichaBln



Joined: 11 Nov 2008
Posts: 18
Location: Berlin, GER

Post Reply with quote
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.
Mon Nov 24, 2008 2:36 pm View user's profile Send private message
snibril



Joined: 26 Oct 2008
Posts: 31

Post Reply with quote
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
Mon Nov 24, 2008 9:50 pm View user's profile Send private message
homeas



Joined: 13 Nov 2008
Posts: 10

Post Reply with quote
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 ...
Sat Jan 31, 2009 8:41 pm View user's profile Send private message
gfoot



Joined: 05 Sep 2007
Posts: 269
Location: Brighton, UK

Post Reply with quote
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++.
Mon Feb 02, 2009 3:43 pm View user's profile Send private message
megabreit



Joined: 03 Jan 2009
Posts: 141

Post Reply with quote
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.
Mon Feb 02, 2009 7:05 pm View user's profile Send private message
nto



Joined: 16 Nov 2009
Posts: 6

Post Reply with quote
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.
Thu Dec 03, 2009 9:18 am View user's profile Send private message
KindeX



Joined: 22 Jul 2010
Posts: 2

Post Reply with quote
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.
Wed Sep 15, 2010 1:26 pm View user's profile Send private message
Display posts from previous:    
Reply to topic    hacker.org Forum Index » Challenges All times are GMT
Goto page 1, 2  Next
Page 1 of 2

 
Jump to: 
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


Powered by phpBB © 2001, 2005 phpBB Group
Design by Freestyle XL / Flowers Online.