login

Year-end appeal: Please make a donation to the OEIS Foundation to support ongoing development and maintenance of the OEIS. We are now in our 61st year, we have over 378,000 sequences, and we’ve reached 11,000 citations (which often say “discovered thanks to the OEIS”).

Define a sequence by s(k) = n*s(k-1) - s(k-2), with s(0) = 1, s(1) = n - 1. a(n) is the smallest index k such that s(k) is prime, or -1 if no such k exists.
5

%I #50 Apr 03 2023 10:36:13

%S -1,-1,1,1,2,1,2,1,2,2,2,1,3,1,3,2,2,1,14,1,2,2,3,1,2,5,2,36,2,1,2,1,

%T 15,-1,6,2,3,1,2,2,6,1,3,1,2,2,2,1,2,3,2,-1,3,1,2,2,2,6,3,1,2,1,30,3,

%U 2,2,2,1,2,5,2,1,5,1,6,3,2,6,3,1,8,6,14,1,3

%N Define a sequence by s(k) = n*s(k-1) - s(k-2), with s(0) = 1, s(1) = n - 1. a(n) is the smallest index k such that s(k) is prime, or -1 if no such k exists.

%C 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.

%C Every positive term belongs to A005097.

%C For detailed theory, see [Hone]. - _L. Edson Jeffery_, Feb 09 2018

%H C. K. Caldwell, Top Twenty page, <a href="https://t5k.org/top20/page.php?id=47">Lehmer number</a>

%H Andrew N. W. Hone, et al., <a href="https://arxiv.org/abs/1802.01793">On a family of sequences related to Chebyshev polynomials</a>, arXiv:1802.01793 [math.NT], 2018.

%H Wikipedia, <a href="http://en.wikipedia.org/wiki/Lehmer_number">Lehmer number</a>

%F If n is prime then a(n+1) = 1.

%e 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).

%e 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).

%t 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 *)

%o 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;

%Y Cf. A005097, A269251, A269253, A269254, A299045 (array used to compute this sequence).

%Y Cf. A294099, A298675, A298677, A298878, A299071, A285992, A299107, A299109, A088165, A117522, A299100, A299101, A113501.

%K sign

%O 1,5

%A _Arkadiusz Wesolowski_, Jul 09 2016