login
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.
1
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,1
FORMULA
a(n) = a(n-1) + (2n-1)*prime(n) + n*(n-1). - Charlie Neder, Jun 21 2019
EXAMPLE
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
PROG
(Excel, VBA)
Sub A308731()
n = 50
Cells(1, 1) = 2
p = 0
For i = 2 To n^2
isPrime = True
For j = 1 To p - 1
If i Mod Cells(j, j) = 0 Then
isPrime = False
Exit For
End If
Next j
If isPrime then
p = p + 1
Cells(p, p) = i
If p >= n Then
Exit For
End If
End If
Next i
For i = 2 To p
For j = 1 To i - 1
Cells(i, j) = Cells(i, i) + i - j
Cells(j, i) = Cells(i, j)
Next j
Next i
For i = 1 To n
Sum = 0
For k = 1 To i
For j = 1 To i
Sum = Sum + Cells(k, j)
Cells(i, n + 1) = Sum
Next j
Next k
Next i
End Sub
(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
CROSSREFS
Cf. A000040.
Sequence in context: A102296 A296807 A366310 * A025194 A084156 A002534
KEYWORD
nonn
AUTHOR
Ali Sada, Jun 20 2019
EXTENSIONS
Edited by Michel Marcus, Jun 21 2019
STATUS
approved