login
A251603
Numbers k such that k + 2 divides k^k - 2.
5
3, 4551, 46775, 82503, 106976, 1642796, 4290771, 4492203, 4976427, 21537831, 21549347, 21879936, 51127259, 56786087, 60296571, 80837771, 87761787, 94424463, 96593696, 138644871, 168864999, 221395539, 255881451, 297460451, 305198247, 360306363, 562654203
OFFSET
1,1
COMMENTS
Numbers k such that (k^k - 2)/(k + 2) is an integer.
Since k == -2 (mod k+2), also numbers k such that k + 2 divides (-2)^k - 2. - Robert Israel, Jan 04 2015
Numbers k == 0 (mod 4) such that A066602(k/2+1) = 8, and odd numbers k such that k = 3 or A082493(k+2) = 8. - Robert Israel, Apr 08 2015
LINKS
Max Alekseyev, Table of n, a(n) for n = 1..890 (all terms below 10^15)
FORMULA
The even terms form A122711, the odd terms are those in A245319 (forming A357125) decreased by 2. - Max Alekseyev, Sep 22 2016
EXAMPLE
3 is in this sequence because 3 + 2 = 5 divides 3^3 - 2 = 25.
MAPLE
isA251603 := proc(n)
if modp(n &^ n-2, n+2) = 0 then
true;
else
false;
end if;
end proc:
A251603 := proc(n)
option remember;
local a;
if n = 1 then
3;
else
for a from procname(n-1)+1 do
if isA251603(a) then
return a;
end if;
end do:
end if;
end proc: # R. J. Mathar, Jan 09 2015
MATHEMATICA
Select[Range[10^6], Mod[PowerMod[#, #, # + 2] - 2, # + 2] == 0 &] (* Michael De Vlieger, Dec 20 2014, based on Robert G. Wilson v at A252041 *)
PROG
(Magma) [n: n in [0..10000] | Denominator((n^n-2)/(n+2)) eq 1];
(PARI) for(n=1, 10^9, if(Mod(n, n+2)^n==+2, print1(n, ", "))); \\ Joerg Arndt, Dec 06 2014
(Python) A251603_list = [n for n in range(1, 10**6) if pow(n, n, n+2) == 2] # Chai Wah Wu, Apr 13 2015
KEYWORD
nonn
AUTHOR
EXTENSIONS
a(6)-a(27) from Joerg Arndt, Dec 06 2014
STATUS
approved