Project Euler 134 - Prime Pair Connection

Official link:

Thought Process

Let p1 < p2 where they are consecutive primes, then the n we are looking for has the following properties

Therefore after generating the necessary primes (all primes up till first one > 1,000,000) (See this page) we can calculate the multiplicative inverse using Euler's Theorem or we can use the python function pow, with pow(k, -1, p) reading
the multiplicative inverse of k modulo p.

Note: k will be equal to 10^(# digits of p1) because we need the ending of n to be p1

Interactive Code

Enter a number (yourinput)

Code will output Sum of S with 5 <= p1 <= yourinput