## Problem:

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 [×] d10 [×] d100 [×] d1000 [×] d10000 [×] d100000 [×] d1000000

210

## Code:The solution may include methods that will be found here: Library.java .

public interface EulerSolution{

public String run();

}
/*
* Solution to Project Euler problem 40
* By Nayuki Minase
*
* http://nayuki.eigenstate.org/page/project-euler-solutions
* https://github.com/nayuki/Project-Euler-solutions
*/

public final class p040 implements EulerSolution {

public static void main(String[] args) {
System.out.println(new p040().run());
}

public String run() {
StringBuilder sb = new StringBuilder();
for (int i = 1; i < 1000000; i++)
sb.append(i);

int prod = 1;
for (int i = 0; i <= 6; i++)
prod *= sb.charAt(Library.pow(10, i) - 1) - '0';
return Integer.toString(prod);
}

}