## Prime pair connection

### Problem 134

Published on Friday, 15th December 2006, 06:00 pm; Solved by 4273; Difficulty rating: 45%Consider the consecutive primes *p*_{1} = 19 and *p*_{2} = 23. It can be verified that 1219 is the smallest number such that the last digits are formed by *p*_{1} whilst also being divisible by *p*_{2}.

In fact, with the exception of *p*_{1} = 3 and *p*_{2} = 5, for every pair of consecutive primes, *p*_{2} > *p*_{1}, there exist values of *n* for which the last digits are formed by *p*_{1} and *n* is divisible by *p*_{2}. Let *S* be the smallest of these values of *n*.

Find ∑ *S* for every pair of consecutive primes with 5 ≤ *p*_{1} ≤ 1000000.