OFFSET
1,2
COMMENTS
If n == 1 (mod 9), then every digit will be replaced by "1". If n == 0 (mod 9), then all nonzero digits will be replaced by "9".
The corresponding n of values a(n)= 1, a(n)= 11, a(n)= 111,... creates a subsequence of A236653. - Davide Rotondo, Mar 04 2024
LINKS
Sebastian Karlsson, Table of n, a(n) for n = 1..10000
Sebastian Karlsson, Generalized and plotted in arbitrary bases
FORMULA
a(10*n) = 10*a(n) + 1.
EXAMPLE
a(26) = 11, since 26^2 = 676 and 26^6 = 308915776. 6 + 7 + 6 = 19, 1 + 9 = 10 and 1 + 0 = 1, so the digital root of 676 is 1. 3 + 0 + 8 + 9 + 1 + 5 + 7 + 7 + 6 = 46, 4 + 6 = 10 and 1 + 0 = 1, so the digital root of 308915776 is 1. Thus, for 26, both "2" and "6" will be replaced by "1".
MATHEMATICA
a[n_] := FromDigits[Mod[n^IntegerDigits[n] - 1, 9] + 1]; Array[a, 100] (* Amiram Eldar, Feb 19 2021 *)
PROG
(Python)
def a(n):
return int(''.join(str((pow(n, int(d), 9)-1)%9 + 1) for d in str(n)))
(PARI) dr(n) = if(n, (n-1)%9+1); \\ A010888
a(n) = my(d=digits(n)); fromdigits(vector(#d, k, dr(n^d[k]))); \\ Michel Marcus, Feb 19 2021
CROSSREFS
KEYWORD
AUTHOR
Sebastian Karlsson, Feb 19 2021
STATUS
approved
