|
|
A269254
|
|
To find a(n), define a sequence by s(k) = n*s(k-1) - s(k-2), with s(0) = 1, s(1) = n + 1; then a(n) is the smallest index k such that s(k) is prime, or -1 if no such k exists.
|
|
17
|
|
|
1, 1, 2, 1, 2, 1, -1, 2, 2, 1, 2, 1, 2, -1, 2, 1, 3, 1, 2, 2, 2, 1, -1, 2, 6, 2, 3, 1, 3, 1, 2, 9, 9, -1, 2, 1, 6, 2, 2, 1, 2, 1, 5, 2, 2, 1, -1, 2, 5, 2, 9, 1, 2, 2, 2, 2, 6, 1, 2, 1, 14, -1, 5, 2, 2, 1, 5, 2, 3, 1, 6, 1, 8, 3, 6, 2, 3, 1, -1, 3, 18, 1, 2, 3, 2, 2, 3, 1, 2, 9, 3, 5, 2, 2, 96, 1, 3, -1, 5, 1, 2, 1, 2, 15, 14, 1, 44, 1, 3, -1
(list;
graph;
refs;
listen;
history;
text;
internal format)
|
|
|
OFFSET
|
1,3
|
|
COMMENTS
|
The s(k) sequences can be viewed in A294099, where they appear as rows. - Peter Munn, Aug 31 2020
For n >= 3, a(n) is that 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.
When n=7, the sequence {s(k)} is A033890, which is Fibonacci(4i+2), and since x|y <=> F_x|F_y, and 2i+1|4i+2, A033890 is never prime, and so a(7)=-1. For the other -1 terms below 100, see the theorem below and the Klee link - N. J. A. Sloane, Oct 20 2017 and Oct 22 2017
Theorem (Brad Klee): For all n > 2, a(n^2 - 2) = -1. See Klee link for a proof. - L. Edson Jeffery, Oct 22 2017
Theorem (Based on work of Hans Havermann, L. Edson Jeffery, Brad Klee, Don Reble, Bob Selcoe, and N. J. A. Sloane) a(110) = -1. [For proof see link. - N. J. A. Sloane, Oct 23 2017]
Suppose n = m^2 - 2, where m >= 3, and let j = m-2, with j >= 1.
For this value of n, the sequence s(k) satisfies s(k) = (c(k) + d(k))*(c(k) - d(k)), where c(0) = 1, d(0) = 0; and for k >= 1: c(k) = (j+2)*c(k-1) - d(k-1), and d(k) = c(k-1). So (as Brad Klee already proved) a(n) = -1 .
We have s(0) = 1 and s(1) = n+1 = j^2 + 4j + 3. In general, the coefficients of s(k) when expanded in powers of j are given by the (4k+2)-th row of A011973 (the triangle of coefficients of Fibonacci polynomials) in reverse order. For example, s(2) = j^4 + 8j^3 + 21j^2 + 20j + 5, s(3) = j^6 + 12j^5 + 55j^4 + 120j^3 + 126j^2 + 56j + 7, etc.
Perhaps the above comments could be generalized to apply to a(110) or to other n for which a(n) = -1?
(End)
|
|
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) = 16, and the recursive equation b(k) = 15*b(k-1) - b(k-2). a(15) = 2 because b(2) = 239 is the smallest prime in b(k).
Let c(k) be the recursive sequence defined by the initial conditions c(0) = 1, c(1) = 18, and the recursive equation c(k) = 17*c(k-1) - c(k-2). a(17) = 3 because c(3) = 5167 is the smallest prime in c(k).
|
|
MATHEMATICA
|
kmax = 100;
a[1] = a[2] = 1;
a[n_ /; IntegerQ[Sqrt[n+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, k <= kmax, k++, If[PrimeQ[s[k]], Return[k]]]; Print["For n = ", n, ", k = ", k, " exceeds the limit kmax = ", kmax]; -1];
|
|
PROG
|
(Magma) lst:=[]; for n in [1..85] do if n gt 2 and IsSquare(n+2) then Append(~lst, -1); else a:=n+1; c:=1; t:=1; if IsPrime(a) then Append(~lst, t); else repeat b:=n*a-c; c:=a; a:=b; t+:=1; until IsPrime(a); Append(~lst, t); end if; end if; end for; lst;
(PARI)
allocatemem(2^30);
default(primelimit, (2^31)+(2^30));
s(n, k) = if(0==k, 1, if(1==k, (1+n), ((n*s(n, k-1)) - s(n, k-2))));
A269254(n) = { my(k=1); if((n>2)&&issquare(2+n), -1, while(!isprime(s(n, k)), k++); (k)); }; \\ Antti Karttunen, Oct 20 2017
|
|
CROSSREFS
|
Cf. A294099 (array used to compute this sequence).
Cf. A285992, A299107, A299109, A088165, A117522, A299100, A299101, A113501, A298675, A298677, A298878, A299045, A299071.
|
|
KEYWORD
|
sign
|
|
AUTHOR
|
|
|
EXTENSIONS
|
|
|
STATUS
|
approved
|
|
|
|