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

Number theory
- 44 Problems
- 21 Finishers
- Pseudo-vampire number
- Pell numbers
- Frugal number
- Be happy
- Bell Triangle
- find nth even fibonacci number
- Cantor counting
- check whether a number is a pentatope number
- generate nth pentatope number
- Fangs of a vampire number
- Find all vampire fangs
- Balanced number
- Mandelbrot Numbers
- Parasitic numbers
- Woodall number
- Kaprekar numbers
- Project Euler: Problem 4, Palindromic numbers
- Fangs of pseudo-vampire number
- Project Euler: Problem 9, Pythagorean numbers
- Mersenne Primes
- Sophie Germain prime
- Determine if input is a Narcissistic number
- Determine if input is a perfect number
- Ordinal numbers
- Lychrel Number Test (Inspired by Project Euler Problem 55)
- Circular Primes (based on Project Euler, problem 35)
- Largest Twin Primes
- Golomb's self-describing sequence (based on Euler 341)
- Is it an Armstrong number?
- Champernowne Constant
- Last non-zero digit
- Generate a Parasitic Number
- Smith numbers
- Evil Number
- Armstrong Number
- Polite numbers. Politeness.
- Polite numbers. N-th polite number.
- Narcissistic number ?
- Is this number Munchhausen?
- P-smooth numbers
- Iccanobif numbers 1
- Amicable numbers
- Extra safe primes
- Pentagonal Numbers
Problem Recent Solvers79
Problem Tags
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!