#### Problem

*An irrational decimal fraction is created by concatenating the positive integers:*

*0.123456789101112131415161718192021…*

*It can be seen that the 12*^{th} digit of the fractional part is 1.

*If d*_{n} represents the n^{th} digit of the fractional part, find the value of the following expression.

*d*_{1} x d_{10} x d_{100} x d_{1000} x d_{10000} x d_{100000} x d_{1000000}

#### Solution

A pretty straight forward solution, the only trick is to turn the sequence of natural numbers 1, 2, 3, … 11, 12, 13.. into a continuous sequence of individual numbers. I did so by taking each number and turning it into a string array of its digits (e.g. 11 –> {"1"; "1"}) and concatenating these arrays using Seq.collect.

Pingback: Project Euler 40: Find the nth digit of an irrational number | mathblog.dk