# [seqfan] Re: Christmas puzzle, reformulated :)

Robert G. Wilson, v rgwv at rgwv.com
Fri Dec 25 17:59:25 CET 2009

```Dear Creighton,

When you get ready to submit this sequence, the Mathematica coding is:
f[n_] := Block[{m = 1, d = If[OddQ at n, 0, 1]}, While[! PrimeQ[n + 2 m + d] || !
PrimeQ[n - 2 m - d], m++]; m];
Array[f, 105]
and the first 105 terms are:
{2, 2, 4, 3, 1, 5, 2, 1, 1, 1, 3, 2, 3, 1, 1, 1, 3, 2, 6, 1, 1, 4, 3, 2, 3, 1, 2,
4, 6, 3, 6, 4, 2, 1, 3, 2, 3, 4, 1, 1, 6, 2, 12, 1, 1, 7, 3, 2, 6, 1, 4, 4, 3, 3,
6, 1, 2, 7, 6, 3, 9, 4, 2, 1, 3, 2, 3, 7, 1, 1, 6, 5, 3, 7, 2, 1, 3, 2, 9, 4, 1,
7, 12, 2, 6, 1, 7, 4, 9, 3, 6, 4, 2, 7, 3, 3, 15, 4, 1, 1, 6, 2, 3, 1, 1}.
Also a %Comment line: First occurrence of m indexed by n:
{5, 1, 4, 3, 6, 19, 46, 207, 61, 128, 336, 43, 136, 492, 97, 146, 318, 163, 238,
699, 191, 286, 1353, 229, 802, 876, 283, 704, 1935, 223, 484, 2487, 743, 362,
2538, 991, 344, 5196, 541, 1198, 2919, 457, 526, 4821, 877, 904, 6453, 1327,
1382, 5979, 1049, 1706, 3147, 1321, 2482, 4749, 1733, 1114, 15801, 1307, 3134,
9942, 1763, 2518, 3057, 3035, 1736, 14916, 1751, 3182, 14106, 5153, 2806, 31341,
2029, 3176, 13536, 2863, 2890, 11097, 2551, 3022, 27243, 1781, 2848, 26889, 4097,
5236, 34119, 2129, 2476, 24363, 6473, 3158, 18708, 3901, 7844, 35313, 4889, 9008}

If you need more terms for the b text file, I can produce that quit rapidly
as well.

Merry Christmas, Bob.

--------------------------------------------------
From: "Creighton Kenneth Dement" <creighton.k.dement at mail.uni-oldenburg.de>
Sent: Friday, December 25, 2009 9:51 AM
To: "Sequence Fanatics Discussion list" <seqfan at list.seqfan.eu>
Subject: [seqfan] Re: Christmas puzzle, reformulated :)

>> Robert Israel schrieb:
>>> If p == 1 mod 3, 2p+1 == 0 mod 3.  If p == 2 mod 3, 2p-1 == 0 mod 3.
>>> So there are no such p > 3.
>>
>> Well, speaking in the tone of Bill Dubuque:
>>
>> SIMPLER!
>> 2p-1, 2p, 2p+1 are three numbers in a row. At least one of them has
>> factor 3, but 2p doesn't have factor 3 for p > 3, p prime.
>>
>> Friendly greetings and a Happy New Year for you,
>> Rainer
>
> Note this is a continuation of the thought behind A082467!
>
> I tried to "reformulate" the question a bit:
>
> Given an n, find m such that
> if n is odd, n + 2*m and n - 2*m are both prime
> if n is even, n + 2*m+1 and n - (2*m+1) are both prime
>
> where in this case I consider n - (2*m+1) to be prime if
> |n - (2*m+1)| is prime.
>
> For odd n:
>
> n: 1, m: 2, (n+2m): 5, (n-2m): -3
> n: 3, m: 4, (n+2m): 11, (n-2m): -5
> n: 5, m: 1, (n+2m): 7, (n-2m): 3
> n: 7, m: 2, (n+2m): 11, (n-2m): 3
> n: 9, m: 1, (n+2m): 11, (n-2m): 7
> n: 11, m: 3, (n+2m): 17, (n-2m): 5
> n: 13, m: 3, (n+2m): 19, (n-2m): 7
> n: 15, m: 1, (n+2m): 17, (n-2m): 13
> n: 17, m: 3, (n+2m): 23, (n-2m): 11
> n: 19, m: 6, (n+2m): 31, (n-2m): 7
> n: 21, m: 1, (n+2m): 23, (n-2m): 19
> n: 23, m: 3, (n+2m): 29, (n-2m): 17
> n: 25, m: 3, (n+2m): 31, (n-2m): 19
> n: 27, m: 2, (n+2m): 31, (n-2m): 23
> n: 29, m: 6, (n+2m): 41, (n-2m): 17
> n: 31, m: 6, (n+2m): 43, (n-2m): 19
> n: 33, m: 2, (n+2m): 37, (n-2m): 29
> n: 35, m: 3, (n+2m): 41, (n-2m): 29
> n: 37, m: 3, (n+2m): 43, (n-2m): 31
> n: 39, m: 1, (n+2m): 41, (n-2m): 37
>
> For even n:
>
> n: 2, m: 2, (n+2m+1): 7, (n-2m-1): -3
> n: 4, m: 3, (n+2m+1): 11, (n-2m-1): -3
> n: 6, m: 5, (n+2m+1): 17, (n-2m-1): -5
> n: 8, m: 1, (n+2m+1): 11, (n-2m-1): 5
> n: 10, m: 1, (n+2m+1): 13, (n-2m-1): 7
> n: 12, m: 2, (n+2m+1): 17, (n-2m-1): 7
> n: 14, m: 1, (n+2m+1): 17, (n-2m-1): 11
> n: 16, m: 1, (n+2m+1): 19, (n-2m-1): 13
> n: 18, m: 2, (n+2m+1): 23, (n-2m-1): 13
> n: 20, m: 1, (n+2m+1): 23, (n-2m-1): 17
> n: 22, m: 4, (n+2m+1): 31, (n-2m-1): 13
> n: 24, m: 2, (n+2m+1): 29, (n-2m-1): 19
> n: 26, m: 1, (n+2m+1): 29, (n-2m-1): 23
> n: 28, m: 4, (n+2m+1): 37, (n-2m-1): 19
> n: 30, m: 3, (n+2m+1): 37, (n-2m-1): 23
> n: 32, m: 4, (n+2m+1): 41, (n-2m-1): 23
> n: 34, m: 1, (n+2m+1): 37, (n-2m-1): 31
> n: 36, m: 2, (n+2m+1): 41, (n-2m-1): 31
>
>
> I don't see the sequence of m's for odd or even n
> or the combining both: (2, 2, 4, 3, 1, 5, 2, 1, 1,...) in the OEIS.
>
> My "reformulated Christmas question" is:
>
> In the "for even n" case, we see that (n-2m) jumps from being negative to
> positive- does it ever go back to being negative?
>
> Similarly, (n-2m-1) in the odd case also jumps from negative to positive
> and apparently never again.
>
> Of course, there is also the looming question of whether an m always
> exists, which is perhaps the most difficult question of all.
>
>
> Happy New Year (whatever calendar you may be using),
> Creighton
>
>
>
>
>
> _______________________________________________
>
> Seqfan Mailing list - http://list.seqfan.eu/

```