P934
projecteuler.net

Unlucky Primes

ℹ️Published on Saturday, 1st March 2025, 10:00 pm; Solved by 281

We define the unlucky prime of a number $n$, denoted $u(n)$, as the smallest prime number $p$ such that the remainder of $n$ divided by $p$ (i.e. $n \bmod p$) is not a multiple of seven.
For example, $u(14) = 3$, $u(147) = 2$ and $u(1470) = 13$.

Let $U(N)$ be the sum $\sum_{n = 1}^N u(n)$.
You are given $U(1470) = 4293$.

Find $U(10^{17})$.



Soluzione

Last modified: August 18, 2025. Website built with Franklin.jl and the lovely Julia programming language.