A place to air possible concerns or difficulties in understanding ProjectEuler problems. This forum is not meant to publish solutions. This forum is NOT meant to discuss solution methods or giving hints how a problem can be solved.
Forum rules
As your posts will be visible to the general public you are requested to be thoughtful in not posting anything that might explicitly give away how to solve a particular problem.
This forum is NOT meant to discuss solution methods for a problem.
In particular don't post any code fragments or results.
Don't start begging others to give partial answers to problems
Don't ask for hints how to solve a problem
Don't start a new topic for a problem if there already exists one
Allasar wrote:
Not giving it away but think about school and how you learned to multiply in your head or by pen and paper. Now try to learn the computer to do it in the same way. For instance, when you were asked to do 28*56, you would do it step by step.
In math, the process of multiplying 28*56 would be:
28
*56
------
168
+1400
-------
1568
In this, you would ignore the entire number and just focus on the 8 and 6 and then focus on the 2 with the eight. And then you would deal with the 5 and do the process over again.
Basically I would have to individually multiply each number separately in order to store 100! appropriately. What Allasar is saying is that in order to store the number, you would have to, one-by-one, multiply number such as 100*99, then take that answer and multiply by 98, etc. Each multiplication could be stored in an array, but how would I somehow still get to the 100! answer. Or did I miss the point of his hint and I just went into circles?
harryh wrote:
This forum is a place for users to air their possible concerns or difficulties in understanding specific ProjectEuler problems.
It is not a forum to discuss solution methods or post spoilers. The proper place to discuss relevant algorithms, solution methods, proofs, results for higher limits etc is of course the thread of each problem which becomes accessible only after submitting the correct answer. Before you start a new topic in this forum, please make sure that a topic for the same problem does not already exist.
If such a topic already exists, please post your question or concern in that topic; it's the only way to keep the number of topics manageable and make it possible to easily search for a specific problem.
If there is no previous topic for the specific problem you are trying to solve, you may start a new topic, giving as subject Problem xxx. Please do not use in the Subject-field expressions like "Clarification needed", "problem with the wording", "Correct answer not accepted" etc
Finally, please do not start topics about specific PE problems in other parts of this bulletin board; it is much easier for everyone to have all the relevant comments, questions etc. collected in one place, i.e. this forum.
As your posts will be visible to the general public you are requested to be thoughtful in not posting anything that might explicitly give away how to solve a particular problem. In particular don't post any code fragments or results.
War ruins the life and health of untold numbers of innocent children.
You are relatively new to this forum. FYI, problem numbers under #100 are padded with leading 0's to make them 3-digit numbers for ease of listing and searching. Your post has been transfered to the proper Problem 020 topic. You may even find an answer to your dilemma by reading other posts in that topic.
When you assume something, you risk being wrong half the time.
zombiekiller222 wrote:Problem 20. I'm 99.999999...% sure the answer I gave is right. Seriously, please check that it works. I gave 713 but it didn't work.
The only thing that some can be sure of is that either the error lies in the user's code or in the understanding of the problem, but it never lies in the Project/Solution Check.
the simple reason for that: other users already solved it
This problem is identical in nature to problem 16 (same deal with a huge number that you need to store and add up digit by digit), yet while my code worked for problem 16, after it spit out the answer for problem 20, the checker rejected it.
Now I know it's against the rules to post my answer. Who would I PM with the number I got (and the code I wrote--it's in R), to double check things? Because I see no reason that it gave me the correct answer for 2^1000 and choked on factorial(100)
This problem is identical in nature to problem 16 (same deal with a huge number that you need to store and add up digit by digit), yet while my code worked for problem 16, after it spit out the answer for problem 20, the checker rejected it.
Now I know it's against the rules to post my answer. Who would I PM with the number I got (and the code I wrote--it's in R), to double check things? Because I see no reason that it gave me the correct answer for 2^1000 and choked on factorial(100)
I am willing to take a look if your language is somewhat similar to C, C#, C++, Java, Haskell or PHP (which it almost always will be )
i started out with 100 then multiplied this by 2 all the way up to 99.
if it isn't, where did i go wrong?
Trying to factor that number, it has the correct powers of 2 and 5, but it is not a multiple of 3, 7, 11...
hmmm. i've coded the problem in such a way that it starts out at 100 * 2 * 3 ... 99. is there someone who i could send my code and see where the fault lies? i modified the code and used it to solve problem 16, so i am at a loss at why it isn't working for this problem.
You can probably debug it yourself if you use the tools which you have available. For example, use your calculator to get the size and the first few digits of n! and compare what your code is giving you for that n. With properly chosen values of n, you can zoom in rapidly to where your code starts being in error.
When you assume something, you risk being wrong half the time.
keynote wrote:hmmm. i've coded the problem in such a way that it starts out at 100 * 2 * 3 ... 99. is there someone who i could send my code and see where the fault lies? i modified the code and used it to solve problem 16, so i am at a loss at why it isn't working for this problem.
thanks.
I'm curious enough to have a look at code that correctly handles multiplication by 2 or 5 but screws up other primes. PM it to me and I'll look this weekend. I know Java, C, Perl..
keynote wrote:hmmm. i've coded the problem in such a way that it starts out at 100 * 2 * 3 ... 99. is there someone who i could send my code and see where the fault lies? i modified the code and used it to solve problem 16, so i am at a loss at why it isn't working for this problem.
thanks.
I'm curious enough to have a look at code that correctly handles multiplication by 2 or 5 but screws up other primes. PM it to me and I'll look this weekend. I know Java, C, Perl..
After a big struggle I managed to get my 16-bit MS-debug programme to go. It is all of 75 bytes long, 17 for preparation, 26 for the multiplication, 9 to add, and another 23 to display the answer. Even the text is shorter than some of high-level languages!
Now I'm curious to know the size of the executable file compiled by high-level languages, C, Ruby, etc, especially the APL/J one...and also the 32-bit solution.
Last edited by whakamaru on Mon Nov 21, 2011 8:33 pm, edited 1 time in total.