cp's OEIS Frontend

This is a front-end for the Online Encyclopedia of Integer Sequences, made by Christian Perfect. The idea is to provide OEIS entries in non-ancient HTML, and then to think about how they're presented visually. The source code is on GitHub.

A174824 a(n) = period of the sequence {m^m, m >= 1} modulo n.

Original entry on oeis.org

1, 2, 6, 4, 20, 6, 42, 8, 18, 20, 110, 12, 156, 42, 60, 16, 272, 18, 342, 20, 42, 110, 506, 24, 100, 156, 54, 84, 812, 60, 930, 32, 330, 272, 420, 36, 1332, 342, 156, 40, 1640, 42, 1806, 220, 180, 506, 2162, 48, 294, 100, 816, 156, 2756, 54, 220, 168, 342
Offset: 1

Views

Author

Keywords

Comments

This is a divisibility sequence: if n divides m, a(n) divides a(m).
We have the equality n = a(n) for numbers n in A124240, which is related to Carmichael's function (A002322). The largest values of a(n) occur when n is prime, in which case a(n) = n*(n-1). - T. D. Noe, Feb 21 2014

Examples

			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
		

Crossrefs

Programs

  • Mathematica
    Table[LCM[n, CarmichaelLambda[n]], {n, 100}] (* T. D. Noe, Feb 20 2014 *)
  • 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

Formula

a(n) = lcm(n, A173614(n)) = lcm(n, A002322(n)) = lcm(n, A011773(n)).
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