A jumping number is defined as a positive number n which all pairs of consecutive decimal digits differ by 1. Also, all single digit numbers are considered jumping numbers. eg. 3, 45676, 212 are jumping numbers but 414 and 13 are not. The difference between 9 and 0 is not considered as 1
The challenge Create a program that output one of the following results:
- Given an input
n
output the firstn
jumping numbers. - Given an input
n
output then
th term of the sequence.
Note
- Any valid I/O format is allowed
- 1-index or 0-index is allowed (please specify)
Here are some jumping numbers:
1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 12, 21, 23, 32, 34, 43, 45, 54, 56, 65, 67, 76, 78, 87, 89, 98, 101, 121, 123, 210, 212, 232, 234, 321, 323, 343, 345, 432, 434, 454, 456, 543, 545, 565, 567, 654, 656, 676, 678, 765, 767, 787, 789, 876, ...
This is also A033075
n
then it is up to you. \$\endgroup\$