OFFSET
1,2
COMMENTS
LINKS
T. D. Noe, Table of n, a(n) for n = 1..1000
José María Grau and Antonio M. Oller-Marcén, On the last digit and the last non-zero digit of n^n in base b, arXiv:1203.4066 [math.NT], 2012. (See page 3)
FORMULA
If n and m are relatively prime, a(n*m) = lcm(a(n), a(m)); a(p^k) = (p-1)*p^k for p prime and k > 0.
a(n) = n*A268336(n). - M. F. Hasler, Nov 13 2019
EXAMPLE
For n=3, 1^1 == 1 (mod 3), 2^2 == 1 (mod 3), 3^3 == 0 (mod 3), etc. The sequence of residues 1, 1, 0, 1, 2, 0, 1, 1, 0, ... has period 6, so a(3) = 6. - Michael B. Porter, Mar 13 2018
MATHEMATICA
Table[LCM[n, CarmichaelLambda[n]], {n, 100}] (* T. D. Noe, Feb 20 2014 *)
PROG
(PARI) a(n)=local(ps); ps=factor(n)[, 1]~; for(k=1, #ps, n=lcm(n, ps[k]-1)); n
(PARI) a(n) = lcm(n, lcm(znstar(n)[2])); \\ Michel Marcus, Mar 18 2016; corrected by Michel Marcus, Nov 13 2019
(PARI) apply( {A174824(n)=lcm(lcm([p-1|p<-factor(n)[, 1]]), n)}, [1..99]) \\ [...] = znstar(n)[2], but 3x faster. - M. F. Hasler, Nov 13 2019
CROSSREFS
KEYWORD
nonn
AUTHOR
Franklin T. Adams-Watters, Mar 30 2010
STATUS
approved