 |
Cheat Engine The Official Site of Cheat Engine
|
| View previous topic :: View next topic |
| Author |
Message |
Symbol I'm a spammer
Reputation: 0
Joined: 18 Apr 2007 Posts: 5094 Location: Israel.
|
Posted: Mon Oct 20, 2008 4:30 am Post subject: |
|
|
| nog_lorp wrote: | | Overload wrote: | | Zand wrote: | | Overload wrote: |
Number two was easy. |
That's not the point. |
The point is to solve them. Thats what I did. I just thought it was easy  |
Wasn't the point of the discussion though. We were talking about superoptimization.
HalfPrime, I'm doing 36 and had an interesting though. The binary check might be faster, but the decimal check fails much more. Is it better to do the faster check first or the check that exempts the other check first?
Symbol: I'm finding a both-bases palindrome you are missing, 585585. Other than that my results are identical. Adding that in gives the correct answer. |
Thanks, appearntly my DecToBin function isn't perfect:
| Quote: | | 585585:5838550947306634551 |
Hehe...
I guess there's a problem with the division of large numbers, it treated the number as signed, I think... I'll just use strings next time.
| Overload wrote: | | Zand wrote: | | Overload wrote: |
Number two was easy. |
That's not the point. |
The point is to solve them. Thats what I did. I just thought it was easy  |
Actually, the point is solving it in the best way, you can't brute force everything here, and some things you can will take a whole day if not more than that, if at all.
There's no point solving these problems if you just solve in the worst way you can find...
Edit: 2 more to level
There are other questions I don't understand, for example 16, how can I sum the digits if 2^1000 has over 300 digits? double can't hold that much digits, it can only save about 30+-.
There are other questions, like "what are the first ten digits of..", same concept.
Edit 2: Level 1
I'm now trying problem 45, I tried brute forcing through 1~999,999, and it found it in about 30 seconds, but there gotta be a better way to do this, other than brute forcing, right?
Edit: the answer is incorrect, anyway.
Last edited by Symbol on Mon Oct 20, 2008 7:36 pm; edited 1 time in total |
|
| Back to top |
|
 |
nog_lorp Grandmaster Cheater
Reputation: 0
Joined: 26 Feb 2006 Posts: 743
|
Posted: Mon Oct 20, 2008 7:08 pm Post subject: |
|
|
For 16 you probably need a digit extraction formula (http://mathworld.wolfram.com/Digit-ExtractionAlgorithm.html) for powers?
For 45, try creating a system of equations:
a(a+1)/2 = b(3b-1)/2
b(3b-1)/2 = c(2c-1)
c(2c-1) = a(a+1)/2
Then try to come up with a single equality that incorporates them all, subtract one side to make it =0 and solve for the roots.
_________________
Mutilated lips give a kiss on the wrist of the worm-like tips of tentacles expanding in my mind
I'm fine accepting only fresh brine you can get another drop of this yeah you wish |
|
| Back to top |
|
 |
Symbol I'm a spammer
Reputation: 0
Joined: 18 Apr 2007 Posts: 5094 Location: Israel.
|
Posted: Mon Oct 20, 2008 7:20 pm Post subject: |
|
|
Yea, I know... 45 was easy, I just used C# (it's the first problem I've used .NET, actually any language other than C++ ), and I accidently typed {1} instead of {0} when printing the result, so it printed the second parameter.
My code was perfectly fine, the first time I ran it, it should've printed the result, but as I said... I made a small mistake.
By the way, thanks for the help, I'll read about the Digit-Extraction Algorithm and see if I understand.
Edit: do you know of any formulas for other number than pi/e?
|
|
| Back to top |
|
 |
nog_lorp Grandmaster Cheater
Reputation: 0
Joined: 26 Feb 2006 Posts: 743
|
Posted: Mon Oct 20, 2008 7:37 pm Post subject: |
|
|
Spigot Algorithm seems to be a better term for about the same thing, http://en.wikipedia.org/wiki/Spigot_algorithm
Also, follow the link to BBP algorithm and look at "BBP type algorithms". I'm working on it right now too, it is definitely not easy mathematics. There have been algorithms for various LN's.
_________________
Mutilated lips give a kiss on the wrist of the worm-like tips of tentacles expanding in my mind
I'm fine accepting only fresh brine you can get another drop of this yeah you wish |
|
| Back to top |
|
 |
HalfPrime Grandmaster Cheater
Reputation: 0
Joined: 12 Mar 2008 Posts: 532 Location: Right there...On your monitor
|
Posted: Mon Oct 20, 2008 8:15 pm Post subject: |
|
|
I'm pretty sure the function for palindromes in base 10 is the same except you'd then have to multiply it by 9 because you have to compute the leading number separately because there's only (possible digits-1) possible digits because we don't want leading 0's. It's done in the binary form, too, but it's just 2-1. and then because base 10 digits take up more bits than binary, to convert the digits, we'd do log10(2^d).
So there's (10^(((log10(2^d))+(log10(2^d))%2)/2-1) )*9 possible base 10 palindromes for d equals binary digits.
_________________
|
|
| Back to top |
|
 |
nog_lorp Grandmaster Cheater
Reputation: 0
Joined: 26 Feb 2006 Posts: 743
|
Posted: Mon Oct 20, 2008 9:07 pm Post subject: |
|
|
Decimal palindromes less than 1mil: 2003
_________________
Mutilated lips give a kiss on the wrist of the worm-like tips of tentacles expanding in my mind
I'm fine accepting only fresh brine you can get another drop of this yeah you wish |
|
| Back to top |
|
 |
Odecey Master Cheater
Reputation: 1
Joined: 19 Apr 2007 Posts: 259 Location: Scandinavia
|
Posted: Mon Oct 20, 2008 10:54 pm Post subject: |
|
|
| nog_lorp wrote: | Spigot Algorithm seems to be a better term for about the same thing, http://en.wikipedia.org/wiki/Spigot_algorithm
Also, follow the link to BBP algorithm and look at "BBP type algorithms". I'm working on it right now too, it is definitely not easy mathematics. There have been algorithms for various LN's. | I thought the point about these is that you're supposed to solve them yourself, instead of searching for already created algorithms to solve them. Takes away some of the point, doesn't it?
_________________
Never confuse activity with productivity. You can be busy without a purpose, but what's the point?- Rick Warren |
|
| Back to top |
|
 |
nog_lorp Grandmaster Cheater
Reputation: 0
Joined: 26 Feb 2006 Posts: 743
|
Posted: Mon Oct 20, 2008 11:10 pm Post subject: |
|
|
... I was discussing the concepts involved. There is no published spigot algorithm for 2^x, its just a concept that could be useful.
EDIT: My calculus 3 professor recommends just using an arbitrary precision type to do the problem. He said it "could take months to work out" a spigot algorithm for someone who wasn't an experienced mathematician. Heh.
Finished. For C/C++ you can use GMP. Or use Python of Java or another language that has built in or standard library support for arbitrary precision.
_________________
Mutilated lips give a kiss on the wrist of the worm-like tips of tentacles expanding in my mind
I'm fine accepting only fresh brine you can get another drop of this yeah you wish |
|
| Back to top |
|
 |
|
|
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 You cannot attach files in this forum You can download files in this forum
|
|