Problem 1477. Champernowne Constant
The Champernowne constant is a real number whose digits in decimal representation come from the concatenation of all consecutive positive integers starting from 1.
That is
0.1234567891011121314151617181920...
This constant is of interest because it can be understood to contain an encoding of any past, present or future information, because any given sequence of numbers can be shown to exist somewhere in the champernowne representation.
Return the nth digit of the champernowne constant. The function takes an array of position values and returns an array of digits corresponding to those positions.
Examples:
[1 2 3 4 5] returns [1 2 3 4 5]
[10 11 12 13 14 15] returns [1 0 1 1 1 2]
[188 289] returns [9 9]
Solution Stats
Problem Comments
-
2 Comments
Please change the example [188 289] in your problem description to [188 189], as I believe [188 289] should return [9 1], rather than [9 9]. (By the way, great job picking 189 to use for a check. Right at the end of the two-digit numbers.)
uint8 is our friend.
Solution Comments
Show commentsGroup

Magic Numbers III
- 15 Problems
- 10 Finishers
- Champernowne Constant
- Pandiagonal Prime Magic Square Verification
- Make a Pandiagonal Prime Magic Square: 11 x 11
- Fangs of a vampire number
- Find all vampire fangs
- is the number happy?
- Pandigital number n°1 (Inspired by Project Euler 32)
- Pandigital number n°2 (Inspired by Project Euler 32)
- Pandigital number n°3 (Inspired by Project Euler 32)
- Pandigital Factors (Based on Euler 491)
- Dudeney Numbers: Numbers which are the cube of their decimal sum
- Factorions: Numbers that equal the sum of the factorials of their digits
- Optimum Egyptian Fractions
- Prime Ladders
- Leftovers? Again?!
Problem Recent Solvers79
Problem Tags
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!