← Complete problem index

PROJECT EULER · #0820

Nth Digit of Reciprocals

Statement only · SolvedOriginal problem ↗

Let dn(x) be the nth decimal digit of the fractional part of x, or 0 if the fractional part has fewer than n digits.

For example:

  • d7(1)=d7(12)=d7(14)=d7(15)=0
  • d7(13)=3 since 13= 0.3333333333...
  • d7(16)=6 since 16= 0.1666666666...
  • d7(17)=1 since 17= 0.1428571428...

Let S(n)=k=1ndn(1k).

You are given:

  • S(7)=0+0+3+0+0+6+1=10
  • S(100)=418

Find S(107).

Write-up coming later

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