%I #43 Aug 14 2019 02:44:21
%S 2,13,44,105,224,397,660,1001,1464,2105,2866,3849,5030,6373,7946,9829,
%T 12048,14489,17310,20459,23872,27731,31972,36707,42060,47861,54022,
%U 60663,67688,75225,83902,93147,103108,113543,125014,136995,149788,163419,177760,192987,209126,225871,243912,262595,282108
%N 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.
%F a(n) = a(n-1) + (2n-1)*prime(n) + n*(n-1). - _Charlie Neder_, Jun 21 2019
%e For n=1, the array is 2, and the sum is 2.
%e .
%e . 2 4
%e For n=2, the array is and the sum is 13.
%e . 4 3
%e .
%e . 2 4 7
%e For n=3, the array is 4 3 6 and the sum is 44.
%e 7 6 5
%o (Excel, VBA)
%o Sub A308731()
%o n = 50
%o Cells(1, 1) = 2
%o p = 0
%o For i = 2 To n^2
%o isPrime = True
%o For j = 1 To p - 1
%o If i Mod Cells(j, j) = 0 Then
%o isPrime = False
%o Exit For
%o End If
%o Next j
%o If isPrime then
%o p = p + 1
%o Cells(p, p) = i
%o If p >= n Then
%o Exit For
%o End If
%o End If
%o Next i
%o For i = 2 To p
%o For j = 1 To i - 1
%o Cells(i, j) = Cells(i, i) + i - j
%o Cells(j, i) = Cells(i, j)
%o Next j
%o Next i
%o For i = 1 To n
%o Sum = 0
%o For k = 1 To i
%o For j = 1 To i
%o Sum = Sum + Cells(k, j)
%o Cells(i, n + 1) = Sum
%o Next j
%o Next k
%o Next i
%o End Sub
%o (PARI) M(i,j) = if (i>=j, prime(i)+i-j, M(j,i));
%o a(n) = sum(i=1, n, vecsum(vector(n, k, M(i,k)))); \\ _Michel Marcus_, Jun 21 2019
%Y Cf. A000040.
%K nonn
%O 1,1
%A _Ali Sada_, Jun 20 2019
%E Edited by _Michel Marcus_, Jun 21 2019