Problem 61014. Find nth number
The numbers 2 and 7 are called lucky numbers, an integer containing only the digits 2 and 7 is also called lucky number. The problem is, given a sequence of lucky numbers arranged in the following order:
Lucky_num=[ 2, 7, 22, 27, 72, 77, 222, 227, 272, 277, 722, 727, 772, 777,.......]
Write a function that takes n as a parameter, we expect the output to be the nth lucky number
Eg:
n=8
-> output: 227
Solution Stats
Problem Comments
-
3 Comments
Christian Schröder
on 19 Oct 2025 at 9:03
I think the test suite may be wrong: the 50th lucky number is 72277, the 110th is 727777, and the 500th is 77772727.
Le
on 20 Oct 2025 at 5:11
thanks for pointing out the mistake, I forgot to round when creating the test case, the test case has been updated.
Ritik
on 20 Oct 2025 at 10:38
It was intitially hard untill i saw the pattern.
Solution Comments
Show commentsProblem Recent Solvers5
Suggested Problems
-
5 Solvers
More from this Author4
Problem Tags
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!