OFFSET
1,1
COMMENTS
a(n) is the weighted average of the first 2n - 1 primes, using row 2n - 2 of Pascal's triangle as weights, with the result rounded down. a(n) is thus based on the longest ordered list of consecutive primes that has prime(n) in the central position, while giving substantially greater weight to the primes near prime(n).
A guiding aim when framing the definition was having the arithmetic mean of the first k terms close to the arithmetic mean of the first k primes. In this respect, a simplified analysis suggested the binomial weighting might perform equally well for large k as small k, and empirical results were encouraging. For all k <= 500 the difference between the means is < 0.541, with 0.5 being exceeded only for 394 <= k <= 401. (These figures become not quite as good if floor rounding is replaced by nearest-integer, though a rounding midway between the two does better than either.)
The early terms (playing the role of primes) correspond closely to A053620 (in the role of primepi function), but the correspondence gets better if nearest-integer rounding is used instead of the floor rounding used here. - Peter Munn, Feb 26 2024
Conjecture: the second differences are in [-2,2].
LINKS
Peter Munn, Table of n, a(n) for n = 1..500
P. Marchand and L. Marmet, Binomial smoothing filter: A way to avoid some pitfalls of least square polynomial smoothing, Review of Scientific Instruments, 54, 1034-41, 1983.
Wikipedia, Smoothing
FORMULA
a(n) = floor(Sum_{k=0..2n-2} (binomial(2n-2,k) * prime(k+1))/2^(2n-2)).
a(n) = floor(A007443(2n-1)/2^(2n-2)).
EXAMPLE
For n=3, we calculate a weighted average of the first 2n - 1 = 5 primes. Row 2n - 2 = 4 of Pascal's triangle, (1,4,6,4,1), provides the weights, and its row sum is 2^4 = 16.
Specifically, using the first formula, a(3) = floor( Sum_{k=0..4}(binomial(4,k)*prime(k+1)) / 2^4 ).
The sum in the formula = 1*prime(1) + 4*prime(2) + 6*prime(3) + 4*prime(4) + 1*prime(5) = 1*2 + 4*3 + 6*5 + 4*7 + 1*11 = 2 + 12 + 30 + 28 + 11 = 83.
So a(3) = floor(83/2^4) = floor(83/16) = 5.
Comparison with the primes: (Start)
Analysis table showing the difference between the start of this sequence and the start of the list of primes. a(n) is subtracted from prime(n) to give a sense of how prime(n) is lower or higher than it might be if the primes were more smoothly distributed. The column headed "cumulative" gives the partial sums of the previous column, which are then divided by n and rounded to 3 decimal places to give the final column. The final column therefore shows the difference between the arithmetic means of the first n primes and the first n terms of this sequence.
n prime(n) a(n) difference cumulative average
1 2 2 0 0 0.000
2 3 3 0 0 0.000
3 5 5 0 0 0.000
4 7 7 0 0 0.000
5 11 10 1 1 0.200
6 13 13 0 1 0.167
7 17 16 1 2 0.286
8 19 20 -1 1 0.125
9 23 24 -1 0 0.000
10 29 28 1 1 0.100
11 31 32 -1 0 0.000
12 37 36 1 1 0.083
13 41 40 1 2 0.154
14 43 44 -1 1 0.071
15 47 48 -1 0 0.000
16 53 53 0 0 0.000
17 59 57 2 2 0.118
18 61 61 0 2 0.111
19 67 66 1 3 0.158
20 71 70 1 4 0.200
21 73 75 -2 2 0.095
22 79 79 0 2 0.091
23 83 84 -1 1 0.043
24 89 89 0 1 0.042
25 97 94 3 4 0.160
26 101 98 3 7 0.269
27 103 103 0 7 0.259
28 107 108 -1 6 0.214
29 109 113 -4 2 0.069
30 113 119 -6 -4 -0.133
31 127 124 3 -1 -0.032
32 131 129 2 1 0.031
(End)
MATHEMATICA
a[n_] := Floor[ Sum[ Binomial[2n -2, k]*Prime[k +1]/2^(2n -2), {k, 0, 2n -2}]]; Array[a, 60] (* Robert G. Wilson v, Jun 10 2018 *)
PROG
(PARI) a(n) = floor(sum(k=0, 2*n-2, (binomial(2*n-2, k) * prime(k+1))/2^(2*n-2))); \\ Michel Marcus, Aug 21 2018
CROSSREFS
KEYWORD
nonn
AUTHOR
Peter Munn, Apr 05 2018
EXTENSIONS
a(51)-a(60) from Robert G. Wilson v, Jun 10 2018
STATUS
approved