Project Euler 234 - Semidivisible numbers

Official link:

Thought Process

Honestly, I don't know what I was doing on this problem. Worked on it for over an hour and then realised I was being dumb, deleted everything, re-did it in 5 mins.

We find all primes below √(999966663333) using my prime generator and we take each pair of consecutive primes, (p1, p2), and find which numbers are semidivisible in the range(p1*p1 +1 ,min{p2*p2 , 999966663333}). We do this because every number in this range will have lps = p1 and ups = p2.

After that using a few smart for loops to sum up all the numbers divisible by p1, p2 ,p1*p2 and the problem is finished

Interactive Code

Input an integer (yourinput)

Code will output sum of all semidivisible numbers not exceeding yourinput