OFFSET
0,2
COMMENTS
LINKS
EXAMPLE
The first terms, in decimal and in base 5, are:
n a(n) q(n) q(a(n))
-- ---- ---- -------
0 0 0 0
1 3 1 3
2 4 2 4
3 1 3 1
4 2 4 2
5 15 10 30
6 18 11 33
7 19 12 34
8 16 13 31
9 17 14 32
10 20 20 40
MATHEMATICA
a[n_] := With[{d = {0, 3, 4, 1, 2}}, FromDigits[d[[IntegerDigits[n, 5] + 1]], 5]]; Array[a, 64, 0] (* Amiram Eldar, Oct 16 2021 *)
PROG
(PARI) a(n, p=[3, 4, 1, 2]) = fromdigits(apply(d -> if (d, p[d], 0), digits(n, #p+1)), #p+1)
CROSSREFS
KEYWORD
nonn,base,easy
AUTHOR
Rémy Sigrist, Oct 14 2021
STATUS
approved