login
If A is the n X n matrix containing the first n^2 primes, a(n) is the sum of the elements of the square of A.
1

%I #37 Jan 12 2024 10:05:11

%S 4,155,3702,39933,244676,1046455,3635046,10406049,26595892,60712839,

%T 128248632,253217949,472633812,837636667,1431878468,2356057659,

%U 3756191658,5844567389,8865989698,13147819241,19100995732,27324708263,38402817766,53116446341,72537301810,97894517685

%N If A is the n X n matrix containing the first n^2 primes, a(n) is the sum of the elements of the square of A.

%H Robert Israel, <a href="/A202298/b202298.txt">Table of n, a(n) for n = 1..1000</a>

%F a(n) = Sum_{j=1..n} (Sum_{i=1..n} prime(i+n*(j-1)) * Sum_{i=1..n} prime(j+n*(i-1))). - _Robert Israel_, Jan 11 2024

%e M2 = [2,3; 5,7], M2*M2 = [19,27; 45,64], so a(2) = 19 + 27 + 45 + 64 = 155.

%p A202298 := proc(n)

%p local A,A2,r,c ;

%p A := Matrix(n, n) ;

%p for r from 0 to n-1 do

%p for c from 0 to n-1 do

%p A[r+1,c+1] := ithprime(1+r*n+c) ;

%p end do:

%p end do:

%p A2 := A^2 ;

%p add(add(A2[r,c],r=1..n),c=1..n) ;

%p end proc: # _R. J. Mathar_, Feb 09 2017

%p # alternative

%p N:= 50: # for a(1)..a(N)

%p P:= [seq(ithprime(i),i=1..N^2)]:

%p f:= proc(n) local M,e,u; M:= Matrix(n,n,P[1..n^2]);

%p e:= Vector(n,1);

%p e^%T . (M . (M . e));

%p end proc:

%p map(f, [$1..N]); # _Robert Israel_, Jan 11 2024

%o (PARI) a(n) = my(m = matrix(n,n, i, j, prime((i-1)*n+j))); my(mm = m^2); sum(k=1, n, vecsum(mm[k,])); \\ _Michel Marcus_, Jan 28 2017

%Y Cf. A000040, A109724.

%K nonn

%O 1,1

%A _Stephen Balaban_, Dec 15 2011

%E More terms from _Michel Marcus_, Jan 28 2017