I'm not sure what your standing was back in 2011, but when I first found Project Euler, I was a lowly high school student in a rural town with a horrible math system. I was also just beginning to learn programming. I iterated through every number. :)
Yeah, it's reasonably basic. For the problem as stated where there are only 1000 numbers to iterate over, though, I wouldn't have bothered wasting time thinking about it when the naive implementation is fast enough that it doesn't matter.
Why start with something more complicated (assuming you're going to program it rather than just solving it outright on paper) when the simple way works?
FizzBuzz with a domain specific language [1] and the N Queens problem without declaring a value type [2]
[1] https://themonadreader.files.wordpress.com/2014/04/fizzbuzz....
[2] https://aphyr.com/posts/342-typing-the-technical-interview
Excellent.
Have you solved it? It looks nontrivial to me.
4503599627370517 is a prime number which means you’re dealing with a cyclic group generated by all nonzero elements up to 4503599627370516. Since the problem chose 1504170715041707 as the generator, any number less than that is potentially an Eulercoin. Of course, only those in decreasing order within the cycle are allowed.
The smallest Eulercoin my naïve C loop could find was 19471 after over 5 minutes of CPU time, with the time to find each one increasing exponentially. This was compiled with clang -O3, running on my 2017 MacBook Pro.
Since we’re dealing with an additive cyclic group, the smallest element will be 0, which is the last Eulercoin. Finding the second-last (the smallest positive element) does not seem to be something you can brute force, as searching the entire cyclic group (4503599627370517 elements including 0) would take my laptop approximately 178 days.
Consider the sequence 1504170715041707n mod 4503599627370517
Could you explain what 'n mod' means? Google doesn't seem to know what that is. n=1 = (mod (* 1504170715041707 1) 4503599627370517) = 1504170715041707
n=2 = (mod (* 1504170715041707 2) 4503599627370517) = 3008341430083414
n=3 = (mod (* 1504170715041707 3) 4503599627370517) = 8912517754604
Most serious Project Euler problems require finding ways to reduce the problem complexity into something manageable. For example, problem 268 is a more complex and challenging version of problem 1, which can't be solved by brute force in a reasonable amount of time [0]. Also, whenever you solve a problem, don't forget to check the problem thread, accessible only to solvers, for many mathematical insights (for example, here's a hint: buried somewhere in problem 10's thread, in what I believe to be the highest rated comment found in any problem thread all over Project Euler, you can find a very useful function that can be used to solve a few, much later, problems).
Also, just yesterday Project Euler released the 700th problem (which is an easy one if you know basic modular arithmetic) [1].
[0] https://projecteuler.net/problem=268
[1] https://projecteuler.net/problem=700