This is a front-end for the Online Encyclopedia of Integer Sequences, made by Christian Perfect. The idea is to provide OEIS entries in non-ancient HTML, and then to think about how they're presented visually. The source code is on GitHub.
%I A308731 #47 May 09 2025 00:59:34 %S A308731 2,13,44,105,224,397,660,1001,1464,2105,2866,3849,5030,6373,7946,9829, %T A308731 12048,14489,17310,20459,23872,27731,31972,36707,42060,47861,54022, %U A308731 60663,67688,75225,83902,93147,103108,113543,125014,136995,149788,163419,177760,192987,209126,225871,243912,262595,282108 %N 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. %F A308731 a(n) = a(n-1) + (2n-1)*prime(n) + n*(n-1). - _Charlie Neder_, Jun 21 2019 %F A308731 a(n) = A316322(n) + A007290(n+1). - _M. F. Hasler_, May 08 2025 %e A308731 For n=1, the array is 2, and the sum is 2. %e A308731 . %e A308731 . 2 4 %e A308731 For n=2, the array is and the sum is 13. %e A308731 . 4 3 %e A308731 . %e A308731 . 2 4 7 %e A308731 For n=3, the array is 4 3 6 and the sum is 44. %e A308731 7 6 5 %o A308731 (Excel, VBA) %o A308731 Sub A308731() %o A308731 n = 50 %o A308731 Cells(1, 1) = 2 %o A308731 p = 0 %o A308731 For i = 2 To n^2 %o A308731 isPrime = True %o A308731 For j = 1 To p - 1 %o A308731 If i Mod Cells(j, j) = 0 Then %o A308731 isPrime = False %o A308731 Exit For %o A308731 End If %o A308731 Next j %o A308731 If isPrime then %o A308731 p = p + 1 %o A308731 Cells(p, p) = i %o A308731 If p >= n Then %o A308731 Exit For %o A308731 End If %o A308731 End If %o A308731 Next i %o A308731 For i = 2 To p %o A308731 For j = 1 To i - 1 %o A308731 Cells(i, j) = Cells(i, i) + i - j %o A308731 Cells(j, i) = Cells(i, j) %o A308731 Next j %o A308731 Next i %o A308731 For i = 1 To n %o A308731 Sum = 0 %o A308731 For k = 1 To i %o A308731 For j = 1 To i %o A308731 Sum = Sum + Cells(k, j) %o A308731 Cells(i, n + 1) = Sum %o A308731 Next j %o A308731 Next k %o A308731 Next i %o A308731 End Sub %o A308731 (PARI) M(i,j) = if (i>=j, prime(i)+i-j, M(j,i)); %o A308731 a(n) = sum(i=1, n, vecsum(vector(n, k, M(i,k)))); \\ _Michel Marcus_, Jun 21 2019 %o A308731 (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)] %o A308731 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 %Y A308731 Cf. A000040, A007290 (partial sums of n(n-1)), A316322 (sum of "pile of primes"). %K A308731 nonn %O A308731 1,1 %A A308731 _Ali Sada_, Jun 20 2019 %E A308731 Edited by _Michel Marcus_, Jun 21 2019