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.

A242872 Least number k > 1 such that (k^k-n^n)/(k-n) is an integer.

Original entry on oeis.org

2, 3, 2, 2, 3, 2, 3, 2, 3, 4, 3, 3, 4, 2, 3, 4, 5, 6, 3, 2, 3, 2, 3, 4, 4, 6, 3, 4, 5, 3, 4, 8, 6, 4, 3, 4, 5, 2, 3, 4, 5, 3, 3, 2, 3, 4, 5, 6, 7, 8, 3, 4, 5, 4, 5, 2, 3, 4, 5, 5, 7, 2, 3, 4, 5, 6, 3, 4, 5, 6, 7, 4, 9, 10, 3, 4, 5, 6, 7, 8, 3, 4, 3, 4, 4, 2, 3, 4, 5, 6, 7, 8, 9, 4
Offset: 1

Views

Author

Derek Orr, May 24 2014

Keywords

Comments

a(n) <= n-1 for n > 2 (since k > 1).
This is also the least number k such that (k^n-n^k)/(k-n) is an integer.

Examples

			(2^2-5^5)/(2-5) = 3121/3 is not an integer. (3^3-5^5)/(3-5) = 3098/2 = 1549 is an integer. Thus a(5) = 3.
		

Crossrefs

Programs

  • Maple
    A242872:= proc(n)
       local nn, k;
       nn:= n^n;
       for k from 2 to n-1 do
          if (nn-k^k) mod (n-k) = 0 then return k fi
       od;
       return n+1;
    end:
    seq(A242872(n),n=1..100); # Robert Israel, May 25 2014
  • Mathematica
    a[n_] := Switch[n, 1, 2, 2, 3, _, With[{nn = n^n}, For[k = 2, True, k++, If[Mod[nn-k^k, n-k] == 0, Return[k]]]]];
    Table[a[n], {n, 1, 100}] (* Jean-François Alcover, May 15 2023 *)
  • PARI
    a(n)=for(k=2,n+1,if(k!=n,s=(k^k-n^n)/(k-n);if(floor(s)==s,return(k))));
    n=1;while(n<100,print(a(n));n+=1)