Project Euler 263 - An engineers' dream come true
Official link: https://projecteuler.net/problem=263
Woohoo!! My first 75% difficulty problem!
My idea was simple, Brute Force...
I generate a bunch of primes, find the three consecutive prime pairs, test if the needed numbers are practical.
To test if the number are practical I followed the wikipedia page: Practical number
There is a pretty straight forward way to test if a number is practical listed on the page using it's prime factorisation, with an accompanying proof, and somehow it is simple to implement (If you have done previous problems)
At first I was thinking that the engineers' paradises were going to be absolutely massive, so I generated the primes up till 500,000,000 using an segmented sieve version of my prime generator, it has nearly the same runtime, but it uses much less memory allowing me to generate more primes.
To my surprise after waiting for my code to finish, I found 3 engineers' paradises, and I thought maybe it was possible to finish this problem, however I would need a much better prime sieve.
I used mCoding's prime sieve because I was watching his video not so long ago. It allows me to extend primes so I wouldn't just have to guess a limit.
Implementing all of the above my code runs in ~ 440 seconds with an upper limit of 1,200,000,000
After reading the forums there are some neat modulo tricks, but most people brute forced it.
No interactive code for this problem, as a guide to the correct path first 2 engineers' paradise numbers are 219869980, 312501820
My code is given below with comments