cp's OEIS Frontend

This is a front-end for the Online Encyclopedia of Integer Sequences, made by Christian Perfect. The idea is to provide OEIS entries in non-ancient HTML, and then to think about how they're presented visually. The source code is on GitHub.

Showing 1-5 of 5 results.

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.

Original entry on oeis.org

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
Offset: 1

Views

Author

Arkadiusz Wesolowski, Jul 09 2016

Keywords

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]
From Bob Selcoe, Oct 24 2017, edited by N. J. A. Sloane, Oct 27 2017: (Start)
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)
For detailed theory, see [Hone]. - L. Edson Jeffery, Feb 09 2018

Examples

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

Crossrefs

Programs

  • 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;
    
  • 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];
    Array[a, 110] (* Jean-François Alcover, Aug 05 2018 *)
  • 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

Formula

If n is prime then a(n-1) = 1.

Extensions

a(86)-a(94) from Antti Karttunen, Oct 20 2017
a(95)-a(109) appended by L. Edson Jeffery, Oct 22 2017

A117522 Numbers k such that L(2*k + 1) is prime, where L(m) is a Lucas number.

Original entry on oeis.org

2, 3, 5, 6, 8, 9, 15, 18, 20, 23, 26, 30, 35, 39, 56, 156, 176, 251, 306, 308, 431, 548, 680, 2393, 2396, 2925, 3870, 4233, 5345, 6125, 6981, 7224, 9734, 17724, 18389, 22253, 25584, 28001, 40835, 44924, 47411, 70028, 74045, 79760, 91544, 96600, 101333, 172146, 193716, 221804, 266138, 287109, 308393, 315590, 318875, 325910, 346073, 450828, 525924
Offset: 1

Views

Author

Parthasarathy Nambi, Apr 26 2006

Keywords

Comments

For n = 24..43, we can only claim that L(2*a(n) + 1) is a probable prime. Sequence arises in a study of A269254; for detailed theory, see [Hone]. - L. Edson Jeffery, Feb 09 2018

Examples

			If k = 56, then L(2*k + 1) is a prime with twenty-four digits.
		

Crossrefs

Extensions

Values beyond 680 from L. Edson Jeffery, et al., Feb 02 2018
a(44)-a(56) from Robert Price, Jun 12 2025
a(57)-a(59) (using data in A001606) from Alois P. Heinz, Jun 12 2025

A269253 Smallest prime in the sequence s(k) = n*s(k-1) - s(k-2), with s(0) = 1, s(1) = n + 1 (or -1 if no such prime exists).

Original entry on oeis.org

2, 3, 11, 5, 29, 7, -1, 71, 89, 11, 131, 13, 181, -1, 239, 17, 5167, 19, 379, 419, 461, 23, -1, 599, 251894449, 701, 20357, 29, 25171, 31, 991, 36002209323169, 47468744103199, -1, 1259, 37, 2625505273, 1481, 1559, 41, 1721, 43, 150103799, 1979, 2069, 47, -1, 2351, 287762399
Offset: 1

Views

Author

Arkadiusz Wesolowski, Jul 09 2016

Keywords

Comments

For n >= 3, smallest prime of the form (x^y - 1/x^y)/(x - 1/x), where x = (sqrt(n+2) +/- sqrt(n-2))/2 and y is an odd positive integer, or -1 if no such prime exists.
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. What is the proof for the other entries that are -1? Answer: See the Comments in A269254. - N. J. A. Sloane, Oct 22 2017
For detailed theory, see [Hone]. - L. Edson Jeffery, Feb 09 2018

Crossrefs

Programs

  • Magma
    lst:=[]; for n in [1..49] do if n gt 2 and IsSquare(n+2) then Append(~lst, -1); else a:=n+1; c:=1; if IsPrime(a) then Append(~lst, a); else repeat b:=n*a-c; c:=a; a:=b; until IsPrime(a); Append(~lst, a); end if; end if; end for; lst;
  • Mathematica
    terms = 172;
    kmax = 120;
    a[n_] := Module[{s, k}, s[k_] := s[k] = n s[k-1] - s[k-2]; s[0] = 1; s[1] = n+1; For[k = 1, k <= kmax, k++, If[PrimeQ[s[k]], Return[s[k]]]]];
    Array[a, terms] /. Null -> -1 (* Jean-François Alcover, Aug 30 2018 *)

Formula

If n is prime then a(n-1) = n.

A299045 Rectangular array: A(n,k) = Sum_{j=0..k} (-1)^floor(j/2)*binomial(k-floor((j+1)/2), floor(j/2))*(-n)^(k-j), n >= 1, k >= 0, read by antidiagonals.

Original entry on oeis.org

1, 1, 0, 1, -1, -1, 1, -2, 1, 1, 1, -3, 5, -1, 0, 1, -4, 11, -13, 1, -1, 1, -5, 19, -41, 34, -1, 1, 1, -6, 29, -91, 153, -89, 1, 0, 1, -7, 41, -169, 436, -571, 233, -1, -1, 1, -8, 55, -281, 985, -2089, 2131, -610, 1, 1, 1, -9, 71, -433, 1926, -5741, 10009, -7953, 1597, -1, 0
Offset: 1

Views

Author

Keywords

Comments

This array is used to compute A269252: A269252(n) = least k such that |A(n,k)| is a prime, or -1 if no such k exists.
For detailed theory, see [Hone].
The array can be extended to k<0 with A(n, k) = -A(n, -k-1) for all k in Z. - Michael Somos, Jun 19 2023

Examples

			Array begins:
1   0  -1     1     0      -1       1         0        -1           1
1  -1   1    -1     1      -1       1        -1         1          -1
1  -2   5   -13    34     -89     233      -610      1597       -4181
1  -3  11   -41   153    -571    2131     -7953     29681     -110771
1  -4  19   -91   436   -2089   10009    -47956    229771    -1100899
1  -5  29  -169   985   -5741   33461   -195025   1136689    -6625109
1  -6  41  -281  1926  -13201   90481   -620166   4250681   -29134601
1  -7  55  -433  3409  -26839  211303  -1663585  13097377  -103115431
1  -8  71  -631  5608  -49841  442961  -3936808  34988311  -310957991
1  -9  89  -881  8721  -86329  854569  -8459361  83739041  -828931049
		

Crossrefs

Cf. A094954 (unsigned version of this array, but missing the first row).

Programs

  • Mathematica
    (* Array: *)
    Grid[Table[LinearRecurrence[{-n, -1}, {1, 1 - n}, 10], {n, 10}]]
    (*Array antidiagonals flattened (gives this sequence):*)
    A299045[n_, k_] := Sum[(-1)^(Floor[j/2]) Binomial[k - Floor[(j + 1)/2], Floor[j/2]] (-n)^(k - j), {j, 0, k}]; Flatten[Table[A299045[n - k, k], {n, 11}, {k, 0, n - 1}]]
  • PARI
    {A(n, k) = sum(j=0, k, (-1)^(j\2)*binomial(k-(j+1)\2, j\2)*(-n)^(k-j))}; /* Michael Somos, Jun 19 2023 */

Formula

G.f. for row n: (1 + x)/(1 + n*x + x^2), n >= 1.
A(n, k) = B(-n, k) where B = A294099. - Michael Somos, Jun 19 2023

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.

Original entry on oeis.org

-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
Offset: 1

Views

Author

Arkadiusz Wesolowski, Jul 09 2016

Keywords

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

Examples

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

Crossrefs

Programs

  • Magma
    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;
  • 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 *)

Formula

If n is prime then a(n+1) = 1.
Showing 1-5 of 5 results.