Your task is simple. Write a program or function which takes three positive integer arguments n, k, and b in any order, such that 2 ≤ b ≤ 36, and returns or outputs the nth (1-indexed) base-b digit after the decimal point of the rational number (bk - 1)-2.
The output must be correct for n and bk up to the largest integer value your language of choice can natively represent. This will most likely mean that you cannot depend on built-in floating point representations to exactly represent the base-b expansion of the number.
Fortunately, this class of numbers has a rather nice property [Spoiler Alert!]: https://www.youtube.com/watch?v=daro6K6mym8
- Base conversion built-ins are permitted.
- Built-in spigot functions capable of indexing digits of exactly represented real numbers are forbidden.
- The digits for base b are the first b symbols in the string "0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ" or alternately "0123456789abcdefghijklmnopqrstuvwxyz". Your choice.
This is code golf. Shortest solution in bytes wins.
(You need not be able to correctly handle all of these if n or bk overflows your integer datatype.)
Input (n,k,b) Output 9846658,3,31 5 789234652,4,10 4 4294967295,17,2 1 4294967254,72,15 B 137894695266,3,30 H 184467440737095595,6,26 L 184467440737095514,999,36 T