|
|
A269252
|
|
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
|
|
|
-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, 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, 2, 2, 2, 1, 2, 5, 2, 1, 5, 1, 6, 3, 2, 6, 3, 1, 8, 6, 14, 1, 3
(list;
graph;
refs;
listen;
history;
text;
internal format)
|
|
|
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.
|
|
LINKS
|
|
|
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
|
Cf. A294099, A298675, A298677, A298878, A299071, A285992, A299107, A299109, A088165, A117522, A299100, A299101, A113501.
|
|
KEYWORD
|
sign
|
|
AUTHOR
|
|
|
STATUS
|
approved
|
|
|
|