A308731 a(n) is the sum of the terms of the symmetric square array defined by M(i,j) = prime(i)+i-j for i >= j and M(i,j) = M(j,i) if i < j.
2, 13, 44, 105, 224, 397, 660, 1001, 1464, 2105, 2866, 3849, 5030, 6373, 7946, 9829, 12048, 14489, 17310, 20459, 23872, 27731, 31972, 36707, 42060, 47861, 54022, 60663, 67688, 75225, 83902, 93147, 103108, 113543, 125014, 136995, 149788, 163419, 177760, 192987, 209126, 225871, 243912, 262595, 282108
Offset: 1
Keywords
Examples
For n=1, the array is 2, and the sum is 2. . . 2 4 For n=2, the array is and the sum is 13. . 4 3 . . 2 4 7 For n=3, the array is 4 3 6 and the sum is 44. 7 6 5
Programs
-
PARI
M(i,j) = if (i>=j, prime(i)+i-j, M(j,i)); a(n) = sum(i=1, n, vecsum(vector(n, k, M(i,k)))); \\ Michel Marcus, Jun 21 2019
-
PARI
A308731_first(N)=vector(N, n, N+=if(n>1, prime(n)*(2*n-1)+n*(n-1), 2-N)) \\ This is a more efficient way to compute the list [a(1), ..., a(N)] apply( {A308731(n)=sum(k=1,n,prime(k)*(2*k-1))+2*binomial(n+1,3)}, [1..20]) \\ M. F. Hasler, May 08 2025
Formula
a(n) = a(n-1) + (2n-1)*prime(n) + n*(n-1). - Charlie Neder, Jun 21 2019
Extensions
Edited by Michel Marcus, Jun 21 2019