Wonky numbers are 3-or-more digit numbers that meet one or more of the following criteria:
- Any digit followed by all zeros:
- Same digit throughout the entirety of the number :
- The digits are in consecutive ascending order :
1234567890(for 0 see below)
- The digits are in consecutive descending order :
- The number is a palindromic number :
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 :
9876543210 for ascending and descending respectively. Numbers can be given in any order, do not assume that it may be in some specific order :
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).
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.