Tim Varley Logo
Tim Varley Systems Engineer

Tim
Varley

Principal Systems Engineer & Technical Lead specializing in distributed systems, AI-driven development, and high-performance infrastructure.

Featured Projects

Recent Solutions

View All →
#030 hard

Digit Fifth Powers

Surprisingly there are only three numbers that can be written as the sum of fourth powers of their digits: $$ \begin{align} 1634 &= 1^4 + 6^4 + 3^4 + 4^4 \\ 8208 &= 8^4 + 2^4 + 0^4 + 8^4 \\ 9474 &= 9^4 + 4^4 + 7^4 + 4^4 \end{align} $$ As $1 = 1^4$ is not a sum it is not included. The sum of these numbers is $1634 + 8208 + 9474 = 19316$. Find the sum of all the numbers that can be written as the sum of fifth powers of their digits.

cpp java javascript
#029 hard

Distinct Powers

Consider all integer combinations of $a^b$ for $2 \le a \le 5$ and $2 \le b \le 5$: $$ \begin{array}{rrrr} 2^2=4, & 2^3=8, & 2^4=16, & 2^5=32 \\ 3^2=9, & 3^3=27, & 3^4=81, & 3^5=243 \\ 4^2=16, & 4^3=64, & 4^4=256, & 4^5=1024 \\ 5^2=25, & 5^3=125, & 5^4=625, & 5^5=3125 \end{array} $$ If they are then placed in numerical order, with any repeats removed, we get the following sequence of $15$ distinct terms: $4, 8, 9, 16, 25, 27, 32, 64, 81, 125, 243, 256, 625, 1024, 3125$. How many distinct terms are in the sequence generated by $a^b$ for $2 \le a \le 100$ and $2 \le b \le 100$?

cpp java javascript
#028 hard

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?

cpp java javascript
#027 hard

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 \le n \le 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 \le n \le 79$. The product of the coefficients, $-79$ and $1601$, is $-126479$. Considering quadratics of the form: $n^2 + an + b$, where $|a| < 1000$ and $|b| \le 1000$ where $|n|$ is the modulus/absolute value of $n$ e.g. $|11| = 11$ and $|-4| = 4$ 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 with $n = 0$.

cpp java javascript
#026 hard

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{align} 1/2 &= 0.5\\ 1/3 &=0.(3)\\ 1/4 &=0.25\\ 1/5 &= 0.2\\ 1/6 &= 0.1(6)\\ 1/7 &= 0.(142857)\\ 1/8 &= 0.125\\ 1/9 &= 0.(1)\\ 1/10 &= 0.1 \end{align}$$ Where $0.1(6)$ means $0.166666\cdots$, and has a $1$-digit recurring cycle. It can be seen that $1/7$ has a $6$-digit recurring cycle. Find the value of $d \lt 1000$ for which $1/d$ contains the longest recurring cycle in its decimal fraction part.

cpp java javascript
#025 hard

1000-digit Fibonacci Number

The Fibonacci 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: $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$ The $12$th 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?

cpp java javascript