← Complete problem index

PROJECT EULER · #0954

Heptaphobia

Statement only · UnsolvedOriginal problem ↗

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(104)=3737.

Find C(1013).

Write-up coming later

The complete problem is available here. An approach, code, and answer will be added later.