Problems & Puzzles: Puzzles

          Puzzle 1217 6*(Prime(n+1)-Prime(n))-7

Sebastián Martín Ruiz sent the following puzzle

Let F(n)=6(Prime(n+1)-Prime(n))-7
F(n) is prime for n=2 to 29
5,5,17,5,17,5,17,29,5,29,17,5,17,29,29,5,29,17,5,29,17,29,41,17,5,17,5,17.
Only 4 from these 28 primes are distinct: {5,17,29,41}

Q) Find other non-trivial function containing both p(n+1) and p(n), that produces larger series of succesive primes and specially with more than 4 distinct primes.


During the week 18-24 April, 2025, contributions came from Giorgos Kalogeropoilos, Michael Branicky, Grant Bell, Simon Cavegn, Gennady Gusev.

Comment: Only Gennady Gusev found a Functions with 20 succesive primes and these primes are all distinct!. See in red below.

***

Giorgos wrote:

F(n)= abs(6(Prime(n+1)-Prime(n))-41)  where abs is the absolute value.

F(n) is prime for n=2 to 188
29,29,17,29,17,29,17,5,29,5,17,29,17,5,5,29,5,17,29,5,17,5,7,17,29,17,29,17,43,17,5,29,19,29,5,5,17,5,5,29,
19,29,17,29,31,31,17,29,17,5,29,19,5,5,5,29,5,17,29,19,43,17,29,17,43,5,19,29,17,5,7,5,5,17,5,7,17,7,19,29,
19,29,5,17,5,7,17,29,17,31,7,17,7,17,5,31,29,67,5,19,5,5,29,5,19,5,5,29,5,5,17,29,31,19,29,17,5,5,29,31,17,
5,7,19,7,19,7,5,5,17,7,5,17,7,17,43,19,31,29,19,29,17,29,19,43,17,29,17,43,17,29,17,79,17,7,19,7,17,5,5,43,
17,5,5,7,5,31,17,5,29,19,29,5,19,29,19,29,5,67,17,29,17,5,5,7,5,5
9 distinct primes {5, 7, 17, 19, 29, 31, 43, 67, 79

***

Michael wrote:

Searching F(n) = a*(prime(n+1) - prime(n)) - b from n = s, I found

  F(n) = 3*(prime(n+1) - prime(n)) - 1 gives 46 successive primes (7 unique) from n=1..46


  * 46 primes: [2, 2, 5, 5, 11, 5, 11, 5, 11, 17, 5, 17, 11, 5, 11, 17, 17, 5, 17, 11, 5, 17, 11, 17, 23, 11, 5, 11, 5, 11, 41, 11, 17, 5, 29, 5, 17, 17, 11, 17, 17, 5, 29, 5, 11, 5]
  *  7 unique: {2, 5, 11, 17, 23, 29, 41}

  F(n) = 120*(prime(n+1) - prime(n)) + 91 gives 77 successive primes (11 unique) from n=791..867


  * 77 primes: [811, 811, 811, 1291, 331, 1291, 1531, 1051, 1291, 331, 1291, 1051, 1531, 1291, 2971, 331, 571, 1051, 811, 571, 1051, 2251, 1291, 811, 811, 331, 811, 1291, 1531, 331, 1291, 811, 811, 811, 1051, 811, 1291, 811, 331, 811, 811, 811, 1291, 1051, 2971, 811, 2731, 331, 2251, 571, 1051, 1291, 3691, 1051, 2251, 571, 331, 1291, 811, 331, 811, 571, 2251, 1051, 1531, 2251, 2011, 811, 331, 1531, 811, 1291, 331, 1291, 331, 811, 1291]
  * 11 unique: {331, 571, 811, 1051, 1291, 1531, 2011, 2251, 2731, 2971, 3691}

  F(n) = 105*(prime(n+1) - prime(n)) - 11 gives 188 successive primes (9 unique) from n=2..189


  * 188 primes: [199, 199, 199, 409, 199, 409, 199, 409, 619, 199, 619, 409, 199, 409, 619, 619, 199, 619, 409, 199, 619, 409, 619, 829, 409, 199, 409, 199, 409, 1459, 409, 619, 199, 1039, 199, 619, 619, 409, 619, 619, 199, 1039, 199, 409, 199, 1249, 1249, 409, 199, 409, 619, 199, 1039, 619, 619, 619, 199, 619, 409, 199, 1039, 1459, 409, 199, 409, 1459, 619, 1039, 199, 409, 619, 829, 619, 619, 409, 619, 829, 409, 829, 1039, 199, 1039, 199, 619, 409, 619, 829, 409, 199, 409, 1249, 829, 409, 829, 409, 619, 1249, 199, 1879, 619, 1039, 619, 619, 199, 619, 1039, 619, 619, 199, 619, 619, 409, 199, 1249, 1039, 199, 409, 619, 619, 199, 1249, 409, 619, 829, 1039, 829, 1039, 829, 619, 619, 409, 829, 619, 409, 829, 409, 1459, 1039, 1249, 199, 1039, 199, 409, 199, 1039, 1459, 409, 199, 409, 1459, 409, 199, 409, 2089, 409, 829, 1039, 829, 409, 619, 619, 1459, 409, 619, 619, 829, 619, 1249, 409, 619, 199, 1039, 199, 619, 1039, 199, 1039, 199, 619, 1879, 409, 199, 409, 619, 619, 829, 619, 619])
  *   9 unique: {199, 409, 619, 829, 1039, 1249, 1459, 1879, 2089}

Searching F(n) = a*(b*prime(n+1) - c*prime(n)) - d, from n = s, I found

  F(n) = (-30*prime(n+1) + 31*prime(n)) + 30 gives 25 successive primes (23 unique) from n=76..100


  * 25 primes: [233, 233, 179, 307, 191, 139, 389, 151, 401, 283, 349, 293, 239, 367, 431, 373, 137, 269, 397, 281, 409, 353, 179, 491, 13]


  * 23 unique: [13, 137, 139, 151, 179, 191, 233, 239, 269, 281, 283, 293, 307, 349, 353, 367, 373, 389, 397, 401, 409, 431, 491]

***

Grant wrote:

Using the generalized formula F(n) = a * P(n+1) - b * P(n) + c, the following has 6 unique primes and is prime itself from n=0 to n= 32. a = 30, b = 30, c = 71
Since a = b, the formula reduces to the simpler 30 * (P(n+1) - P(n)) + 71
F(0) is `101`
F(1) is `131`
F(2) is `131`
F(3) is `191`
F(4) is `131`
...
F(28) is `191`
F(29) is `491`
F(30) is `191`
F(31) is `251`
F(32) is `131`

More solutions include: 
a = b = 9228, c = -3055 => n < [0, 29), F(n) < {6157, 15401, 33857, 52313, 70769}
a = b = 24030, c = -8479 => n < [0, 45), F(n) < {15551, 39581, 87641, 135701, 183761, 327941, 231821}

Longest sequences I could find where `a` and `b` were distinct I found particularly interesting:
a = 43, b = -2, c = -120
F(0) is `13`
F(1) is `101`
F(2) is `191`
F(3) is `367`
F(4) is `461`

a = -43, b = -58, c = 114
F(0) is `101`
F(1) is `73`
F(2) is `103`
F(3) is `47`
F(4) is `193`
F(5) is `137`
F(6) is `283`
F(7) is `227`

a = -21, b = -126, c = -50 => n < [0, 11)
a = 120, b = 30, c = -49 => n = [0, 13)
a = -15, b = -30, c = 14 => n = [0, 14) This is the first one where a != b where repeats of F(n) occur!

***

Simon wrote:

3*prime(n+1) - 3*prime(n) - 1
n=0..44
2,5,5,11,5,11,5,11,17,5,17,11,5,11,17,17,5,17,11,5,17,11,17,23,11,5,11,5,11,41,11,17,5,29,5,17,17,11,17,17,5,29,5,11,5
Distinct:2,5,11,17,23,29,41

if negative primes were allowed:

-6*prime(n+1) + 6*prime(n) + 65
n=0..152
59,53,53,41,53,41,53,41,29,53,29,41,53,41,29,29,53,29,41,53,29,41,29,17,41,53,41,53,41,-19,41,29,53,5,53,29,29,41,29,29,53,5,53,41,53,-7,-7,41,53,41,29,53,5,29,29,29,53,29,41,53,5,-19,41,53,41,-19,29,5,53,41,29,17,29,29,41,29,17,41,17,5,53,5,53,29,41,29,17,41,53,41,-7,17,41,17,41,29,-7,53,-43,29,5,29,29,53,29,5,29,29,53,29,29,41,53,-7,5,53,41,29,29,53,-7,41,29,17,5,17,5,17,29,29,41,17,29,41,17,41,-19,5,-7,53,5,53,41,53,5,-19,41,53,41,-19,41,53,41
Distinct:-43,-19,-7,5,17,29,41,53,59

-30*prime(n+1) + 30*prime(n) + 187
n=0..152
157,127,127,67,127,67,127,67,7,127,7,67,127,67,7,7,127,7,67,127,7,67,7,-53,67,127,67,127,67,-233,67,7,127,-113,127,7,7,67,7,7,127,-113,127,67,127,-173,-173,67,127,67,7,127,-113,7,7,7,127,7,67,127,-113,-233,67,127,67,-233,7,-113,127,67,7,-53,7,7,67,7,-53,67,-53,-113,127,-113,127,7,67,7,-53,67,127,67,-173,-53,67,-53,67,7,-173,127,-353,7,-113,7,7,127,7,-113,7,7,127,7,7,67,127,-173,-113,127,67,7,7,127,-173,67,7,-53,-113,-53,-113,-53,7,7,67,-53,7,67,-53,67,-233,-113,-173,127,-113,127,67,127,-113,-233,67,127,67,-233,67,127,67
Distinct:-353,-233,-173,-113,-53,7,67,127,157

***

Gennady wrote:

If we write F(n) as a*prime(n+1) + b*prime(n) + c, then
 
For a,b,c: -93, 105,  35 and n=29, 30, ...48, we have exactly 20 primes and all are different:
971   89 1187 1049 1493  773 1637 1289 1361 1619 1481 1553 1997 1277 2141 1979 2213 1307 1451 2339
 
For a,b,c:  31, -30, -180 and n=110, 111...135, we get 26 primes and 24 of them are different:
 607  613  557  499  811  761  523  587  653  659  541  853  617  683  751  821  769  839  787  733  739  683  811  757  701  829 (The repetitive ones are highlighted in bold).
 
For a,b,c: 105, -105, -11 and n=2,3,... 188, we get 187 primes, but only 9 different primes
199  199  409  199  409  199  409  619  199  619  409  199  409  619  619  199  619  409  199  619  409  619  829  409  199  409  199  409 1459  409  619  199 1039  199  619  619  409  619  619  199 1039  199  409  199 1249 1249  409  199  409  619  199 1039  619  619  619  199  619  409  199 1039 1459  409  199  409 1459  619 1039  199  409  619  829  619  619  409  619  829  409  829 1039  199 1039  199  619  409  619  829  409  199  409 1249  829  409  829  409  619 1249  199 1879  619 1039  619  619  199  619 1039  619  619  199  619  619  409  199 1249 1039  199  409  619  619  199 1249  409  619  829 1039  829 1039  829  619  619  409  829  619  409  829  409 1459 1039 1249  199 1039  199  409  199 1039 1459  409  199  409 1459  409  199  409 2089  409  829 1039  829  409  619  619 1459  409  619  619  829  619 1249  409  619  199 1039  199  619 1039  199 1039  199  619 1879  409  199  409  619  619  829  619  619
 
different primes :  199  409  619  829 1459 1039 1249 1879 2089.

***

On April 30, 2025, Adam Stinchcombe wrote:

I found the formula abs(-45*[p(n+1)-p(n)]+533) was prime for n=2..281 (a sequence of 280 n values) and produced the following twelve unique primes    {7, 83, 97, 367, 997, 443, 263, 353, 457, 173, 547, 277}.

Once I was focused on functions of the prime gap p(n+1)-p(n), I realized we could employ primes in arithmetic progressions.  The first known length 27 PAP is    224584605939537911+81292139*23#*n   which is prime for n=0..26 (where 23# stands for the product of primes <= 23) (due to Rob Gahan and PrimeGrid in 2019).  For n from 2 to 30801, I get a list of primes gaps of {2, 4, 6, 8, 10, 12, 14, 16, 18, 20, 22, 24, 26, 28, 30, 32, 34, 36, 38, 40, 42, 44, 46, 48, 50, 52, 54, 56, 58, 60, 62, 64, 66, 68, 70, 72, 76, 78, 82, 86}, I subtract 42, take the absolute value, and divide by two to get arguments (for the PAP) of [0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 22].

So for 2<=n<=30801, the formula   224584605939537911+81292139*23#*( 1/2*abs(p(n+1)-p(n)-42) ) produces 22 distinct primes.  Those distinct primes are   {224584605939537911, 587298537898516511, 569162841300567581, 333398785527231491, 369670178723129351, 260855999135435771, 623569931094414371, 351534482125180421, 442212965114925071, 551027144702618651, 532891448104669721, 478484358310822931, 405941571919027211, 514755751506720791, 297127392331333631, 496620054908771861, 424077268516976141, 242720302537486841, 278991695733384701, 387805875321078281, 460348661712874001, 315263088929282561}.

One might find other sequences of primes where the gaps are "densely packed" and get a longer sequence for the n values, rather than starting with the small primes.  TBA.

 

***

Records   |  Conjectures  |  Problems  |  Puzzles