login
Numbers n such that (n^n-2^2)/(n-2) is an integer.
3

%I #19 Apr 24 2016 08:49:45

%S 1,3,4,6,8,14,20,22,38,44,56,62,86,102,110,128,158,164,182,222,254,

%T 296,302,326,344,380,422,470,488,502,542,590,622,662,686,758,782,822,

%U 884,902,974,1028,1094,1102,1136,1262,1316,1334,1406,1460,1502,1622,1766,1808

%N Numbers n such that (n^n-2^2)/(n-2) is an integer.

%C a(n) is even for all n > 2. 1 and 3 are members of this sequence because (n^n-2^2)/(n-2) becomes (2^2-n^n) and (n^n-2^2), respectively, which are both integers.

%C Given the term (n^n-k^k)/(n-k) (here, k=2), whenever k = 2^m for some m, there are significantly fewer data values within a given range of numbers. See A242871 for k=3.

%C These are also numbers n such that (2^n-n^2)/(n-2) is an integer.

%H Robert Israel, <a href="/A242870/b242870.txt">Table of n, a(n) for n = 1..10000</a>

%e (4^4-2^2)/(4-2) = 252/2 = 126 is an integer. Thus, 4 is a member of this sequence.

%p filter:= proc(n) (n&^n - 4) mod (n-2) = 0 end proc;

%p select(filter, [1,$3..1000]); # _Robert Israel_, May 25 2014

%t Join[{1},Select[Range[3,2000],IntegerQ[(#^#-4)/(#-2)]&]] (* _Harvey P. Dale_, Apr 24 2016 *)

%o (PARI) for(n=1,2500,if(n!=2,s=(n^n-2^2)/(n-2);if(floor(s)==s,print(n))))

%Y Cf. A242871.

%K nonn

%O 1,2

%A _Derek Orr_, May 24 2014