A269251 a(n) = smallest prime in the sequence s(k) = n*s(k-1) - s(k-2), with s(0) = 1, s(1) = n - 1 (or a(n) = -1 if no such prime exists).
-1, -1, 2, 3, 19, 5, 41, 7, 71, 89, 109, 11, 2003, 13, 3121, 239, 271, 17, 729962708557509701, 19, 419, 461, 11593, 23, 599, 11356201, 701, 11546481261621528160662473705515857458665002781273993, 811, 29, 929
Offset: 1
Keywords
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
Crossrefs
Programs
-
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;
-
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 *)
Formula
If n is prime then a(n+1) = n.
Extensions
Changed the value for the exceptional case from 0 to -1 for consistency with other sequences. - N. J. A. Sloane, Jan 19 2018
Comments