A335185 a(n) = nextprime(ceiling(n/2)-1) - prevprime(floor(n/2)+1), where nextprime = A151800 and prevprime = A151799.
0, 1, 0, 2, 2, 2, 0, 2, 2, 2, 0, 4, 4, 4, 4, 4, 4, 4, 0, 2, 2, 2, 0, 4, 4, 4, 4, 4, 4, 4, 0, 2, 2, 2, 0, 4, 4, 4, 4, 4, 4, 4, 0, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 0, 2, 2, 2, 0, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 0, 4, 4, 4, 4, 4, 4, 4, 0, 2, 2, 2, 0, 4, 4, 4, 4, 4, 4, 4, 0, 6, 6, 6
Offset: 4
Examples
a(5) = 1; n=5 has 2 partitions into two parts: (4,1) and (3,2). Among the largest parts, the smallest prime is 3. Among the smallest parts, 2 is the largest. So a(5) = 3 - 2 = 1. a(6) = 0; n=6 has 3 partitions into two parts: (5,1), (4,2) and (3,3). Among the largest parts, the smallest prime is 3. Among the smallest parts, the largest prime is 3. So a(6) = 3 - 3 = 0. a(7) = 2; n=7 has 3 partitions into two parts: (6,1), (5,2) and (4,3). Among the largest parts, 5 is the smallest. Among the smallest parts, 3 is the largest. So a(7) = 5 - 3 = 2.
Programs
-
Magma
[NextPrime(Ceiling(n/2)-1) - PreviousPrime(Floor(n/2)+1) : n in [4..100]];
-
Mathematica
Table[NextPrime[Ceiling[n/2] - 1, 1] - NextPrime[Floor[n/2] + 1, -1], {n, 4, 100}]
Comments