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
As multiple squaring of the numbers makes them soon very big, we are suggested (very wisely) to give the result modulo 1234567891.
My question is: are we expected to apply modulo 1234567891:
In the step 2 already? – So each calculated square is possibly made smaller before replacing it's predecessor in the list.
In the step 4 only? – While summing the list.
I found the trick to optimise high powers of numbers modulo 1234567891, but if in the step 1 I must compare original numbers (without modulo) I can not benefit from my optimization trick
Or am I missing something?
bruce_love wrote: Sun Mar 03, 2024 9:23 pm
Use the modulus in step 4 only - so you can't use your optimising trick (or can you).
I could use my trick if all the list elements are either raised to the same power or I could predict their final powers. But the final powers of list elements are neither equal nor predictable, as the lower the value of the element list, the higher the power. So before the last (1016th) comparison, I could not predict the final power of each element, so I could not decide about using the trick (or could I).