OFFSET
0,3
COMMENTS
To represent a number in base 8, if a digit exceeds 7, subtract 8 and carry 1. In the fractional base 8/5, subtract 8 and carry 5.
LINKS
EXAMPLE
The integers 0 through 7 are written with the digits 0 through 7.
Then, since b = 8/5 is written as 10, and 8 is five times 8/5, 8 is 50 in base 8/5, and therefore a(8) = 50.
a(16) = 520, since 5 * (8/5)^2 + 2 * (8/5) = 5 * 64/25 + 2 * 8/5 = 64/5 + 16/5 = 80/5 = 16.
MATHEMATICA
Select[Table[FromDigits[IntegerDigits[n, 8]], {n, 0, 4095}], IntegerQ[FromDigits[IntegerDigits[#], 8/5]] &] (* Alonso del Arte, Aug 05 2019 *)
a[n_] := a[n] = If[n == 0, 0, 10 * a[5 * Floor[n/8]] + Mod[n, 8]]; Array[a, 50, 0] (* Amiram Eldar, Aug 02 2025 *)
PROG
(PARI) a(n) = if(n == 0, 0, 10 * a(n\8 * 5) + n % 8); \\ Amiram Eldar, Aug 02 2025
CROSSREFS
KEYWORD
nonn,base,easy
AUTHOR
STATUS
approved
