Tim
Varley
Principal AI Engineer and Tech Leader specializing in distributed systems, AI-driven development, and high-performance infrastructure.
Recent Essays
View All →Series
The AI Engineering Transformation
How engineering leaders can transform their teams from individual contributors into high-velocity AI orchestrators while managing risk and measuring real business impact.
The AI Engineer Mindset
Introduction to the 5-part series exploring the fundamental shift in how engineers relate to creation, control, and cognition when directing AI agents.
Featured Projects
AI-Native IoT Platform
AI-native IoT platform optimizing water and energy consumption with distributed sensor networks, built entirely using advanced LLM agents.
AI-Native Portfolio & Blog
A high-performance personal platform built 100% via autonomous AI agents, directed by senior engineering architectural patterns. Demonstrates the power of experience-driven agentic workflows.
AI-Generated Euler Solutions
A repository of 50+ mathematical algorithm solutions generated entirely by AI agents. Showcases how deep engineering expertise guides AI to produce optimal, mathematically rigorous code.
B2B E-commerce Marketplace
Cloud-native B2B e-commerce platform disrupting the promotional products industry with extreme scalability and 20% cost optimization.
Enterprise SaaS Migration
Transformed legacy monolithic software into cloud-native microservices architecture, achieving 170% performance boost and 99.9% uptime.
High-Frequency Financial Infrastructure
Mission-critical financial data infrastructure delivering embargoed government economic releases to trading systems in under 15 milliseconds.
FinTech Patent Solution
Pioneering multi-channel banking system architecture that earned a US patent and Smithsonian Innovation Award for bridging legacy and digital banking.
Recent Solutions
View All →Singular Integer Right Triangles
It turns out that **12 cm** is the smallest length of wire that can be bent to form an integer sided right angle triangle in exactly one way, but there are many more examples. - **12 cm**: $(3,4,5)$ - **24 cm**: $(6,8,10)$ - **30 cm**: $(5,12,13)$ - **36 cm**: $(9,12,15)$ - **40 cm**: $(8,15,17)$ - **48 cm**: $(12,16,20)$ In contrast, some lengths of wire, like **20 cm**, cannot be bent to form an integer sided right angle triangle, and other lengths allow more than one solution to be found; for example, using **120 cm** it is possible to form exactly three different integer sided right angle triangles. - **120 cm**: $(30,40,50)$, $(20,48,52)$, $(24,45,51)$ Given that $L$ is the length of the wire, for how many values of $L \le 1\,500\,000$ can exactly one integer sided right angle triangle be formed?
Digit Factorial Chains
The number $145$ is well known for the property that the sum of the factorial of its digits is equal to $145$: $$1! + 4! + 5! = 1 + 24 + 120 = 145.$$ Perhaps less well known is $169$, in that it produces the longest chain of numbers that link back to $169$; it turns out that there are only three such loops that exist: $$\begin{align} &169 \to 363601 \to 1454 \to 169\\ &871 \to 45361 \to 871\\ &872 \to 45362 \to 872 \end{align}$$ It is not difficult to prove that EVERY starting number will eventually get stuck in a loop. For example, $$\begin{align} &69 \to 363600 \to 1454 \to 169 \to 363601 (\to 1454)\\ &78 \to 45360 \to 871 \to 45361 (\to 871)\\ &540 \to 145 (\to 145) \end{align}$$ Starting with $69$ produces a chain of five non-repeating terms, but the longest non-repeating chain with a starting number below one million is sixty terms. How many chains, with a starting number below one million, contain exactly sixty non-repeating terms?
Counting Fractions in a Range
Consider the fraction, $\dfrac n d$, where $n$ and $d$ are positive integers. If $n \lt d$ and $\operatorname{HCF}(n, d)=1$, it is called a reduced proper fraction. If we list the set of reduced proper fractions for $d \le 8$ in ascending order of size, we get: $$\frac 1 8, \frac 1 7, \frac 1 6, \frac 1 5, \frac 1 4, \frac 2 7, \frac 1 3, \mathbf{\frac 3 8, \frac 2 5, \frac 3 7}, \frac 1 2, \frac 4 7, \frac 3 5, \frac 5 8, \frac 2 3, \frac 5 7, \frac 3 4, \frac 4 5, \frac 5 6, \frac 6 7, \frac 7 8$$ It can be seen that there are $3$ fractions between $\dfrac 1 3$ and $\dfrac 1 2$. How many fractions lie between $\dfrac 1 3$ and $\dfrac 1 2$ in the sorted set of reduced proper fractions for $d \le 12\,000$?
Counting Fractions
Consider the fraction, $\dfrac n d$, where $n$ and $d$ are positive integers. If $n \lt d$ and $\operatorname{HCF}(n,d)=1$, it is called a reduced proper fraction. If we list the set of reduced proper fractions for $d \le 8$ in ascending order of size, we get: $$\frac 1 8, \frac 1 7, \frac 1 6, \frac 1 5, \frac 1 4, \frac 2 7, \frac 1 3, \frac 3 8, \frac 2 5, \frac 3 7, \frac 1 2, \frac 4 7, \frac 3 5, \frac 5 8, \frac 2 3, \frac 5 7, \frac 3 4, \frac 4 5, \frac 5 6, \frac 6 7, \frac 7 8$$ It can be seen that there are $21$ elements in this set. How many elements would be contained in the set of reduced proper fractions for $d \le 1\,000\,000$?
Ordered Fractions
Consider the fraction, $\dfrac n d$, where $n$ and $d$ are positive integers. If $n \lt d$ and $\operatorname{HCF}(n,d)=1$, it is called a reduced proper fraction. If we list the set of reduced proper fractions for $d \le 8$ in ascending order of size, we get: $$\frac 1 8, \frac 1 7, \frac 1 6, \frac 1 5, \frac 1 4, \frac 2 7, \frac 1 3, \frac 3 8, \mathbf{\frac 2 5}, \frac 3 7, \frac 1 2, \frac 4 7, \frac 3 5, \frac 5 8, \frac 2 3, \frac 5 7, \frac 3 4, \frac 4 5, \frac 5 6, \frac 6 7, \frac 7 8$$ It can be seen that $\dfrac 2 5$ is the fraction immediately to the left of $\dfrac 3 7$. By listing the set of reduced proper fractions for $d \le 1\,000\,000$ in ascending order of size, find the numerator of the fraction immediately to the left of $\dfrac 3 7$.
Totient Permutation
Euler's totient function, $\phi(n)$ [sometimes called the phi function], is used to determine the number of positive numbers less than or equal to $n$ which are relatively prime to $n$. For example, as $1, 2, 4, 5, 7$, and $8$, are all less than nine and relatively prime to nine, $\phi(9)=6$.<br/>The number $1$ is considered to be relatively prime to every positive number, so $\phi(1)=1$. Interestingly, $\phi(87109)=79180$, and it can be seen that $87109$ is a permutation of $79180$. Find the value of $n$, $1 \lt n \lt 10^7$, for which $\phi(n)$ is a permutation of $n$ and the ratio $n/\phi(n)$ produces a minimum.