News for hackers. Stuff that matters.
Re:Project Euler 001 the Hard Way by gordaco on Monday February 03, 2020 @11:12AM (#22225455)
Yes, I solved it, but not by that method. When I talked about "basic modular arithmetic" I didn't mean repeated addition and the usage of "mod"; I mean that I used certain basic operation which gets taught in any introductory discrete math program. Sorry if I don't get very specific, I don't want to spoil it :). A suggestion: think about the end of the sequence and move backwards from there.
Re:Project Euler 001 the Hard Way by chongli on Tuesday February 04, 2020 @12:43AM (#22232775)
I solved it. My solution was pretty ugly. I ended up brute-forcing it from both directions after finding the multiplicative inverse. Did you have a more elegant solution?
Re:Project Euler 001 the Hard Way by gordaco on Tuesday February 04, 2020 @10:55AM (#22236987)
No, my solution was also mostly "brute-forcing from both directions". In the problem thread you can find more elegant solutions that rely on calculating increments, but my approach was very fast (0.3 seconds) so it's good enough for me.