OFFSET
1,5
COMMENTS
For n >= 2, positive integer k yielding the smallest prime of the form (x^y + 1/x^y)/(x + 1/x), where x = (sqrt(n+2) +/- sqrt(n-2))/2 and y = 2*k + 1, or -1 if no such k exists.
Every positive term belongs to A005097.
For detailed theory, see [Hone]. - L. Edson Jeffery, Feb 09 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) = 1.
EXAMPLE
Let b(k) be the recursive sequence defined by the initial conditions b(0) = 1, b(1) = 10, and the recursive equation b(k) = 11*b(k-1) - b(k-2). a(11) = 2 because b(2) = 109 is the smallest prime in b(k).
Let c(k) be the recursive sequence defined by the initial conditions c(0) = 1, c(1) = 12, and the recursive equation c(k) = 13*c(k-1) - c(k-2). a(13) = 3 because c(3) = 2003 is the smallest prime in c(k).
MATHEMATICA
s[k_, m_] := s[k, m] = Which[k == 0, 1, k == 1, 1 + m, True, m s[k - 1, m] - s[k - 2, m]]; Table[SelectFirst[Range[120], PrimeQ@ Abs@ s[#, -n] &] /. k_ /; MissingQ@ k -> -1, {n, 85}] (* Michael De Vlieger, Feb 03 2018 *)
PROG
lst:=[]; for n in [1..85] do if n in [1, 2, 34, 52] then Append(~lst, -1); else a:=1; c:=1; t:=0; repeat b:=n*a-c; c:=a; a:=b; t+:=1; until IsPrime(a); Append(~lst, t); end if; end for; lst;
CROSSREFS
KEYWORD
sign
AUTHOR
Arkadiusz Wesolowski, Jul 09 2016
STATUS
approved