APL (Dyalog), 3 bytes
9|⍴2|⍴
Try it online!Try it online! (the test suite generates a range of numbers from 1
to 10000
, converts them to a string, and then applies the train 9|⍴2|⍴
on them).
Takes the input number as a string and returns its length mod 92. So 123
=> 3 mod 92
=> 31
.
The sequence starts off like so:
1 1 1 1 1 1 1 1 1 20 20 20 20 20 20 ...
until it reaches 100000000
, at which point the resulting output is 0
because the length of that string isso this can be generalised like so: 9 1s 90 0s 900 1s ...
. And this non-repeating cycle will continue until eternity. Hence, this number is irrational.
And the reason for theMultiplying this number by 9 gives us a mod 9
Liouville number, which is so that numbers greater than 1e9
will still give single digit outputsproven to be transcendental.