← Complete problem index

PROJECT EULER · #0817

Digits in Squares

Statement only · SolvedOriginal problem ↗

Define m=M(n,d) to be the smallest positive integer such that when m2 is written in base n it includes the base n digit d. For example, M(10,7)=24 because if all the squares are written out in base 10 the first time the digit 7 occurs is in 242=576. M(11,10)=19 as 192=361=2A911.

Find d=1105M(p,pd) where p=109+7.

Write-up coming later

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