Prime permutations

The arithmetic sequence, 1487, 4817, 8147, in which each of the terms increases by 3330, is unusual in two ways: (i) each of the three terms are prime, and, (ii) each of the 4-digit numbers are permutations of one another.

There are no arithmetic sequences made up of three 1-, 2-, or 3-digit primes, exhibiting this property, but there is one other 4-digit increasing sequence.

Self powers

The series, 1^1 + 2^2 + 3^3 + … + 10^10 = 10405071317.

Find the last ten digits of the series, 1^1 + 2^2 + 3^3 + … + 1000^1000.

Distinct primes factors

The first two consecutive numbers to have two distinct prime factors are:

```        14 = 2 × 7
15 = 3 × 5
```

The first three consecutive numbers to have three distinct prime factors are:

```        644 = 2² × 7 × 23
645 = 3 × 5 × 43
646 = 2 × 17 × 19.
```

Goldbach’s other conjecture

It was proposed by Christian Goldbach that every odd composite number can be written as the sum of a prime and twice a square.

```        9  = 7  + 2×1^2
15 = 7  + 2×2^2
21 = 3  + 2×3^2
25 = 7  + 2×3^2
27 = 19 + 2×2^2
33 = 31 + 2×1^2
```

Triangular, pentagonal, and hexagonal

Triangle, pentagonal, and hexagonal numbers are generated by the following formula:

```
Triangle    Tn=n(n+1)/2     1, 3, 6, 10, 15, ...
Pentagonal  Pn=n(3n−1)/2    1, 5, 12, 22, 35, ...
Hexagonal   Hn=n(2n−1)      1, 6, 15, 28, 45, ...

```

It can be verified that T285 = P165 = H143 = 40755.

Find the next triangle number that is also pentagonal and hexagonal.

Pentagon numbers

Pentagonal numbers are generated by the formula, Pn=n(3n−1)/2. The first ten pentagonal numbers are:

```        1, 5, 12, 22, 35, 51, 70, 92, 117, 145, ...
```

It can be seen that P4 + P7 = 22 + 70 = 92 = P8. However, their difference, 70 − 22 = 48, is not pentagonal.

Find the pair of pentagonal numbers, Pj and Pk, for which their sum and difference are pentagonal and D = |Pk − Pj| is minimised; what is the value of D?