Suppose we have a sequence \$P\$. Every element \$P_n\$ represents the distance between the \$n^{th}\$ prime number and the average of the next two prime numbers.
For example, \$P_1\$ would be the distance between the first prime number (2) and the average of the next two prime numbers (3 and 5), so \$P_1 = \frac{3+5}{2} - 2 = 2\$. Similarly, \$P_2 = \frac{5+7}{2} - 3 = 3\$.
Input
Your input is an integer \$n\$. You may assume \$n>0\$.
Output
Your task is to print out the sequence \$P\$ up to \$n\$, starting from \$P_1\$. You can format your output however you like as long as every element is clearly separated.
Rules
- This is code-golf, so shortest number of bytes wins.
- You can assume that every computed number will be within the limits of the language you choose, so no need to worry about how big \$n\$ or \$P_n\$ can get.
Test cases
Input Output
n = 1 2
n = 2 2, 3
n = 5 2, 3, 4, 5, 4
n = 10 2, 3, 4, 5, 4, 5, 4, 7, 7, 5
(If you're curious, this sequence is A305748!)