Problem 40

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

0.123456789101112131415161718192021…

It can be seen that the 12th digit of the fractional part is 1.

If dn represents the nth digit of the fractional part, find the value of the following expression.

d1 x d10 x d100 x d1000 x d10000 x d100000 x d1000000

始めはどういう無理数なのか、問題文を読んでも分からなかった・・・

import Data.Char
p40 =product.map (digitToInt.(frac!!).(10^))$ [..6]
where  frac = concatMap show [,1..]
More Reading
Newer// Problem 39
Older//