PyPE solution to PE problem 40
PyPE solution to PE problem 40
Blueprint information
- Status:
- Complete
- Approver:
- None
- Priority:
- Undefined
- Drafter:
- None
- Direction:
- Needs approval
- Assignee:
- None
- Definition:
- Approved
- Series goal:
- None
- Implementation:
- Implemented
- Milestone target:
- None
- Started by
- Scott Armitage
- Completed by
- Scott Armitage
Related branches
Related bugs
Sprints
Whiteboard
ProjectEule
===
An irrational decimal fraction is created by concatenating the positive
integers:
It can be seen that the 12th 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 * d_10 * d_100 * d_1000 * d_10000 * d_100000 * d_1000000
Solution
--------
Froget the "factional" part; just say that d_n is looking for the nth digit
in the series concat([0,1,2,...]) (starting at d_0 = 0). I feel dirty for
it, but Python is so good at strings that I was able to easily brute-force
this one.
There are the startings of a numeric solution for n < 10 and n < 100; it
may be possible to generalize these formula for any n.
Answer
------
210