Task :
Wonky numbers are 3-or-more digit numbers that meet one or more of the following criteria:
- Any digit followed by all zeros:
100
,70000
- Same digit throughout the entirety of the number :
1111
,777777777
- The digits are in consecutive ascending order :
1234
,1234567890
(for 0 see below) - The digits are in consecutive descending order :
4321
,9876543210
- The number is a palindromic number :
1221
,123321
Ascending and descending order mean no repeated digits in their so 122
is not ascending in this case, you may also not skip digits 1245
is not Wonky because 3 is missing. For both ascending and descending numbers 0 will come last so order is : 1234567890
and 9876543210
for ascending and descending respectively. Numbers can be given in any order, do not assume that it may be in some specific order : 1234
, 987
, 76842
are all valid numbers.
I / O :
Your input will always be a number (positive) in the following range : $$99 < Z < 1,000,000,000$$
Check if the number is a Wonky number.
You may not take input as anything but a number unless your language is simply incapable of handling that, in which case take input in any reasonable format (per language)
You may output any truthy value (for wonky numbers) and any falsy value (for non wonky numbers).
Examples :
Input : Output
100 : true
12344321 : true
77777777777 : true
132 : false
321 : true
122 : false
987789 : true
98765 : true
120000 : false
100001 : true
786 : false
890 : true
Extra Credit :
Check if number is not a Wonky number, but one of next x
numbers is a wonky number, where x is in range of 1 (inclusive) to 10 (exclusive).
This is code-golf, so shortest code in bytes wins.
0
can't be an input. \$\endgroup\$