OFFSET
1,3
COMMENTS
For n >= 2, smallest prime of the form (x^y + 1/x^y)/(x + 1/x), where x = (sqrt(n+2) +- sqrt(n-2))/2 and y is an odd positive integer, or -1 if no such prime exists.
If a(34) > 0 then a(34) > 10^1000. - Robert Israel, Feb 06 2018
For detailed theory, see [Hone]. - L. Edson Jeffery, Feb 09 2018
Values of n where a(n) might need more than 1000 digits: 34, 52, 123, 254, 275, 285, 322, 371, 401, 413, 437, 460, 508, 518, 535, 540, 629, 643, 653, 691, 723, 724, 753, 797, 837, 843, 876, 881, 898, 913, 960, 970, 981, 986, 987, ... - Jean-François Alcover, Mar 01 2018
LINKS
C. K. Caldwell, Top Twenty page, Lehmer number
Andrew N. W. Hone, et al., On a family of sequences related to Chebyshev polynomials, arXiv:1802.01793 [math.NT], 2018.
Wikipedia, Lehmer number
FORMULA
If n is prime then a(n+1) = n.
MAPLE
f:= proc(n) local a, b, t;
a:= 1; b:= n-1;
do
if isprime(b) then return b fi;
t:= n*b-a;
a:= b;
b:= t;
od
end proc:
f(1):= -1: f(2):= -1:
map(f, [$1..33]); # Robert Israel, Feb 06 2018
MATHEMATICA
max = 10^1000; a[1] = a[2] = -1; a[n_] := Module[{s}, s[0] = 1; s[1] = n-1; s[k_] := s[k] = n s[k-1] - s[k-2]; For[k = 1, s[k] <= max, k++, If[PrimeQ[s[k]], Return[s[k]]]]] /. Null -> -1; Table[a[n], {n, 1, 33}] (* Jean-François Alcover, Mar 01 2018 *)
PROG
(Magma) lst:=[]; for n in [1..31] do if n le 2 then Append(~lst, 0); else a:=1; c:=1; repeat b:=n*a-c; c:=a; a:=b; until IsPrime(a); Append(~lst, a); end if; end for; lst;
CROSSREFS
KEYWORD
sign
AUTHOR
Arkadiusz Wesolowski, Jul 09 2016
EXTENSIONS
Changed the value for the exceptional case from 0 to -1 for consistency with other sequences. - N. J. A. Sloane, Jan 19 2018
STATUS
approved