#28 - Number spiral diagonals

Starting with the number 1 and moving to the right in a clockwise direction a 5 by 5 spiral is formed as follows:

21 22 23 24 25
20  7  8  9 10
19  6  1  2 11
18  5  4  3 12
17 16 15 14 13

It can be verified that the sum of the numbers on the diagonals is 101.

What is the sum of the numbers on the diagonals in a 1001 by 1001 spiral formed in the same way?


#27 - Quadratic primes

Euler discovered the remarkable quadratic formula: \[n^2+n+41\]

It turns out that the formula will produce 40 primes for the consecutive integer values $0\leq n\leq 39$. However, when $n = 40, 40^2+40+41=40(40+1)+41$ is divisible by 41, and certainly when $n=41,41^2+41+41$ is clearly divisible by 41.

The incredible formula $n^2-79n+1601$ was discovered, which produces 80 primes for the consecutive values $0\leq n\leq 79$. The product of the coefficients, -79 and 1601, is -126479.

Considering quadratics of the form: \[n^2+an+b,\text{ where } |a|<1000\text{ and } |b|\leq 1000\]

where the bars indicate absolute value.

Find the product of the coefficients, $a$ and $b$, for the quadratic expression that produces the maximum number of primes for consecutive values of $n$, starting $n=0$.


#26 - Reciprocal cycles

A unit fraction contains 1 in the numerator. The decimal representation of the unit fractions with denominators 2 to 10 are given: \[\begin{aligned} \frac{1}{2} &= 0.5 \\ \frac{1}{3} &= 0.\overline{3} \\ \frac{1}{4} &= 0.25 \\ \frac{1}{5} &= 0.2 \\ \frac{1}{6} &= 0.1\overline{6} \\ \frac{1}{7} &= 0.\overline{142857} \\ \frac{1}{8} &= 0.125 \\ \frac{1}{9} &= 0.\overline{1} \\ \frac{1}{10} &= 0.1 \end{aligned}\]

where $0.1\overline{6}$ means 0.166666…, and has a 1-digit recurring cycle. It can be seen that $\frac{1}{7}$ has a 6-digit recurring cycle.

Find the value of $d<1000$ for which $\frac{1}{d}$ contains the longest recurring cycle in its decimal fraction part.


#25 - 1000-digit Fibonacci number

The Fibonnaci sequence is defined by the recurrence relation: \[F_n = F_{n-1} + F_{n-2}\]

where $F_1=1$ and $F_2=1$.

Hence the first 12 terms will be: \[\begin{aligned} F_1 &= 1 \\ F_2 &= 1 \\ F_3 &= 2 \\ F_4 &= 3 \\ F_5 &= 5 \\ F_6 &= 8 \\ F_7 &= 13 \\ F_8 &= 21 \\ F_9 &= 34 \\ F_{10} &= 55 \\ F_{11} &= 89 \\ F_{12} &= 144 \end{aligned}\]

The 12th term, $F_{12}$, is the first term to contain three digits.

What is the index of the first term in the Fibonacci sequence to contain 1000 digits?


#24 - Lexicographic permutations

A permutation is an ordered arrangement of objects. For example, 3124 is one possible permutation of the digits 1, 2, 3, and 4. If all the permutations are listed numerically or alphabetically, we call it lexicographic order. The lexicographic permutations of 0, 1 and 2 are:

012 021 102 120 201 210

What is the millionth lexicographic permutation of the digits 0, 1, 2, 3, 4, 5, 6, 7, 8 and 9?


#23 - Non-abundant sums

A perfect number is a number for which the sum of its proper divisors is exactly equal to the number. For example, the sum of the proper divisors of 28 would be 1 + 2 + 4 + 7 + 14 = 28, which means that 28 is a perfect number.

A number $n$ is called deficient if the sum of its proper divisors is less than $n$ and it is called abundant if this sum exceeds $n$.

As 12 is the smallest abundant number, 1 + 2 + 3 + 4 + 6 = 16, the smallest number that can be written as the sum of two abundant numbers is 24. By mathematical analysis, it can be shown that all integers greater than 28123 can be written as the sum of two abundant numbers. However, this upper limit cannot be reduced any further by analysis even though it is known that the greatest number that cannot be expressed as the sum of two abundant numbers is less than this limit.

Find the sum of all the positive integers which cannot be written as the sum of two abundant numbers.


#22 - Names scores

Using names.txt (right click and ‘Save Link/Target As…’), a 46k text file containing over five-thousand first names, begin by sorting it into alphabetical order. Then working out the alphabetical value for each name, multiply this value by its alphabetical position in the list to obtain a name score.

For example, when the list is sorted into alphabetical order, COLIN, which is worth 3 + 15 + 12 + 9 + 14 = 53, is the 938th name in the list. So, COLIN would obtain a score of 938 x 53 = 49714.

What is the total of all the name scores in the file?


#21 - Amicable numbers

Let $d(n)$ be defined as the sum of proper divisors of $n$ (numbers less than $n$ which divide evenly into $n$). If $d(a) = b$ and $d(b) = a$, where $a\neq b$, then $a$ and $b$ are an amicable pair and each of $a$ and $b$ are called amicable numbers.

For example, the proper divisors of 220 are 1, 2, 4, 5, 10, 11, 20, 22, 44, 55 and 110; therefore $d(220) = 284$. The proper divisors of 284 are 1, 2, 4, 71, and 142; so $d(284) = 220$.

Evaluate the sum of all the amicable numbers under 10000.


#20 - Factorial digit sum

$n!$ means $n\times (n-1)\times\cdots\times 3\times 2\times 1$.

For example, $10! = 10\times 9\times\cdots\times 3\times 2\times 1 = 3628800$, and the sum of the digits in the number $10!$ is 3 + 6 + 2 + 8 + 8 + 0 + 0 = 27.

Find the sum of the digits in the number $100!$.


Pagination