Recently I had a Maths test and noticed that a certain number on the test matched an interesting pattern. The number (
28384) matched a generic digit sequence that looks like this
x are single digit integers. The sequence can begin with either
n and end with either
Your task is, given a multi digit positive integer, output a truthy or falsey value, depending on whether the input matches the pattern. The input will be between 4 and 18 digits long. You may take input as a string representation of the integer. The input will not begin with a 0 but can contain or end with 0s.
n+y will always be a single digit number (hence why the length limit is 18).
These should output a truthy value
182838485868788898 4344 85868 12223242526
And these should be falsey
12345 6724013635 36842478324836 1222232425 5859510511
As with all code golfs, shortest code wins! Good luck and may the odds, be ever in your favour!