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.

A117659 Number of solutions to x^(k+2)=x^k mod n for some k>=1.

Original entry on oeis.org

1, 2, 3, 4, 3, 6, 3, 8, 5, 6, 3, 12, 3, 6, 9, 12, 3, 10, 3, 12, 9, 6, 3, 24, 7, 6, 11, 12, 3, 18, 3, 20, 9, 6, 9, 20, 3, 6, 9, 24, 3, 18, 3, 12, 15, 6, 3, 36, 9, 14, 9, 12, 3, 22, 9, 24, 9, 6, 3, 36, 3, 6, 15, 36, 9, 18, 3, 12, 9, 18, 3, 40, 3, 6, 21
Offset: 1

Views

Author

Steven Finch, Apr 11 2006

Keywords

Comments

If n is an odd prime, a(n) = 3, and the solutions are x = 0, 1, and -1. For n = 2, the solutions are the same, but a(n) = 2 since 1 and -1 are equal (mod 2). - Michael B. Porter, Jul 08 2016
The set of solutions is independent of the choice of k. - Michael B. Porter, Jul 08 2016

Examples

			For n = 10, using k = 1, the solutions are x = 0, 1, 4, 5, 6, and 9, so a(10) = 6. - _Michael B. Porter_, Jul 08 2016
		

Crossrefs

Cf. A117658.

Programs

  • Mathematica
    Table[Sum[Floor[(k^(n + 2) - k^n)/n] - Floor[(k^(n + 2) - k^n - 1)/n], {k, n}], {n, 75}] (* Michael De Vlieger, Jul 07 2016 *)
    f[2, e_] := If[e < 3, 2^e, 2^(e - 1) + 4]; f[p_, e_] := p^(e - 1) + 2; a[1] = 1; a[n_] := Times @@ f @@@ FactorInteger[n]; Array[a, 100] (* Amiram Eldar, Sep 08 2020 *)
  • PARI
    a(n) = sum(k=1, n, (k^(n+2)-k^n)\n - (k^(n+2)-k^n -1)\n); \\ Michel Marcus, Jul 07 2016

Formula

a(n) = Sum_{k=1..n} floor((k^(n+2)-k^n)/n)-floor((k^(n+2)-k^n -1)/n). - Anthony Browne, Jul 06 2016
Multiplicative with a(2^e) = 2^e for e < 3 and 2^(e-1) + 4 for e >= 3, and a(p^e) = p^(e-1) + 2 for p > 2. - Amiram Eldar, Sep 08 2020