login
a(n) = (n-6)*sqrt((n-5)^2) + 2*n + 31.
0

%I #42 Mar 19 2021 07:03:25

%S 13,23,31,37,41,43,47,53,61,71,83,97,113,131,151,173,197,223,251,281,

%T 313,347,383,421,461,503,547,593,641,691,743,797,853,911,971,1033,

%U 1097,1163,1231,1301,1373,1447,1523,1601

%N a(n) = (n-6)*sqrt((n-5)^2) + 2*n + 31.

%C Euler's expression f(n) = n^2 - n + 41 generates 40 consecutive terms that are prime, but this sequence contains 44 consecutive terms that are prime.

%C The first differences of Euler's polynomial are the even numbers 2 and up. This sequence extends backwards for four further terms in a similar way:

%C terms: 13 23 31 37 41 43 47 53 61 71 ...

%C 1st differences: 10 8 6 4 2 4 6 8 10 ...

%C 2nd differences: -2 -2 -2 -2 2 2 2 2 ...

%C So this sequence consists of two quadratic pieces: one with 2nd differences -2, the other with second differences +2.

%C The terms that are primes from Euler's expression are 41, 43, 47, 53, 61, ...; each of these can be obtained by adding to 41 the product of 2 and the sum of the first k nonnegative integers:

%C 41 + 2*(0) = 41 (prime)

%C 41 + 2*(0 + 1) = 43 (prime)

%C 41 + 2*(0 + 1 + 2) = 47 (prime)

%C 41 + 2*(0 + 1 + 2 + 3) = 53 (prime)

%C 41 + 2*(0 + 1 + 2 + 3 + 4) = 61 (prime)

%C etc. The sum of the first k nonnegative integers is (k-1)*k/2, and adding 41 to twice that sum gives 2*(k-1)*k/2 + 41 = k^2 - k + 41.

%C Also, for k = 1..5, subtracting 2 times the sum of the first k positive integers from 43 gives 5 primes in a row:

%C 43 - 2*(1) = 41 (prime)

%C 43 - 2*(1 + 2) = 37 (prime)

%C 43 - 2*(1 + 2 + 3) = 31 (prime)

%C 43 - 2*(1 + 2 + 3 + 4) = 23 (prime)

%C 43 - 2*(1 + 2 + 3 + 4 + 5) = 13 (prime)

%C (The next term in the above sequence, 43 - 2*(1 + 2 + 3 + 4 + 5 + 6) = 1, is not a prime number.)

%C So this sequence is piecewise quadratic and consists of two overlapping quadratic subsequences: one contains the 5 terms 13, 23, 31, 37, 41, while the other contains the 40 terms from Euler's expression, i.e., 41, 43, 47, ..., 1601, and there is one overlapping term (41), for a total of 5 + 40 - 1 = 44 terms, all of which are prime.

%H <a href="/index/Rec#order_03">Index entries for linear recurrences with constant coefficients</a>, signature (3,-3,1).

%F a(n) = (n-6)*sqrt((n-5)^2) + 2*n + 31.

%F From _Jon E. Schoenfield_, Mar 18 2021: (Start)

%F a(n) = -n^2 + 13*n + 1 for n <= 5,

%F n^2 - 9*n + 61 for n >= 5.

%F (Note that the formulas for both pieces of this piecewise quadratic formula hold at n = 5.) (End)

%F G.f.: x*(13 - 16*x + x^2 + 4*x^6)/(1 - x)^3. - _Stefano Spezia_, Mar 09 2021

%p seq((n-6)*abs(n-5) + 2*n + 31, n = 1..44); # _Peter Luschny_, Mar 19 2021

%t Rest@ CoefficientList[Series[x (13 - 16 x + x^2 + 4 x^6)/(1 - x)^3, {x, 0, 44}], x] (* or *)

%t Block[{$MaxExtraPrecision = 1000}, Array[(# - 6) Sqrt[(# - 5)^2] + 2 # + 31 &, 44]] (* _Michael De Vlieger_, Mar 17 2021 *)

%Y Cf. A005846.

%K nonn,easy

%O 1,1

%A _Youichiro Murakami_, Mar 07 2021