P954
projecteuler.net

Heptaphobia

ℹ️Published on Sunday, 13th July 2025, 08:00 am; Solved by 186;
Difficulty level: 27

A positive integer is called heptaphobic if it is not divisible by seven and no number divisible by seven can be produced by swapping two of its digits. Note that leading zeros are not allowed before or after the swap.

For example, $17$ and $1305$ are heptaphobic, but $14$ and $132$ are not because $14$ and $231$ are divisible by seven.

Let $C(N)$ count heptaphobic numbers smaller than $N$. You are given $C(100) = 74$ and $C(10^4) = 3737$.

Find $C(10^{13})$.



Soluzione

Last modified: February 25, 2026. Website built with Franklin.jl and the lovely Julia programming language.