38 lines
1.8 KiB
Text
38 lines
1.8 KiB
Text
An '''esthetic number''' is a positive integer where every adjacent digit differs from its neighbour by 1.
|
||
|
||
|
||
;E.G.
|
||
|
||
:* '''12''' is an esthetic number. One and two differ by 1.
|
||
|
||
:* '''5654''' is an esthetic number. Each digit is exactly 1 away from its neighbour.
|
||
|
||
:* '''890''' is '''not''' an esthetic number. Nine and zero differ by 9.
|
||
|
||
|
||
These examples are nominally in base 10 but the concept extends easily to numbers in other bases. Traditionally, single digit numbers ''are'' included in esthetic numbers; zero may or may not be. For our purposes, for this task, do not include zero (0) as an esthetic number. Do not include numbers with leading zeros.
|
||
|
||
Esthetic numbers are also sometimes referred to as stepping numbers.
|
||
|
||
|
||
;Task
|
||
|
||
:* Write a routine (function, procedure, whatever) to find esthetic numbers in a given base.
|
||
|
||
:* Use that routine to find esthetic numbers in bases '''2''' through '''16''' and display, here on this page, the esthectic numbers from index '''(base × 4)''' through index '''(base × 6)''', inclusive. (E.G. for base 2: 8th through 12th, for base 6: 24th through 36th, etc.)
|
||
|
||
:* Find and display, here on this page, the '''base 10''' esthetic numbers with a magnitude between '''1000''' and '''9999'''.
|
||
|
||
:* Stretch: Find and display, here on this page, the '''base 10''' esthetic numbers with a magnitude between '''1.0e8''' and '''1.3e8'''.
|
||
|
||
|
||
;Related task:
|
||
* [[Numbers_With_Equal_Rises_and_Falls|numbers with equal rises and falls]]
|
||
|
||
|
||
;See also:
|
||
:;*[[oeis:A033075|OEIS A033075 - Positive numbers n such that all pairs of consecutive decimal digits differ by 1]]
|
||
:;*[http://www.numbersaplenty.com/set/esthetic_number/ Numbers Aplenty - Esthetic numbers]
|
||
:;*[https://www.geeksforgeeks.org/stepping-numbers/ Geeks for Geeks - Stepping numbers]
|
||
<br><br>
|
||
|