reviewed
approved
reviewed
approved
proposed
reviewed
editing
proposed
(PARI) lista(nn) = { A=matrix(nn, nn); my(b=vector(nn^2)); S=Set(); for(s=2, nn+1, for(i=1, s-1, if(s%2, q=[i, s-i], q=[s-i, i]); p=[sum(j=1, q[2]-1, A[q[1], j]), sum(j=1, q[1]-1, A[j, q[2]])]; n=1; while(setsearch(S, n) || (p[1]&&!isprime(p[1]+n)) || (p[2]&&isprime(p[2]+n)), n++); A[q[1], q[2]]=n; S=setunion(S, Set([n])); mm=(q[1]+q[2]-1)*(q[1]+q[2]-2)/2 + q[2]*(1 + (-1)^(q[1]+q[2]))/2 + q[1]*(1 - (-1)^(q[1]+q[2]))/2; b[n]=mm; )); for(ii=1, nn^2, if (b[ii], print1(b[ii], ", "), break)); } \\ If the desired a(n) does not appear in the output is 0, , then one needs to increase the value of nn in lista(nn) until a(n) becomes positiveappears. This program is a modification of the PARI program by Max Alekseyev in A082228. - Petros Hadjicostas, Feb 25 2021
proposed
editing
editing
proposed
(PARI) lista(nn) = { A=matrix(nn, nn); my(b=vector(nn^2)); S=Set(); for(s=2, nn+1, for(i=1, s-1, if(s%2, q=[i, s-i], q=[s-i, i]); p=[sum(j=1, q[2]-1, A[q[1], j]), sum(j=1, q[1]-1, A[j, q[2]])]; n=1; while(setsearch(S, n) || (p[1]&&!isprime(p[1]+n)) || (p[2]&&isprime(p[2]+n)), n++); A[q[1], q[2]]=n; S=setunion(S, Set([n])); mm=(q[1]+q[2]-1)*(q[1]+q[2]-2)/2 + q[2]*(1 + (-1)^(q[1]+q[2]))/2 + q[1]*(1 - (-1)^(q[1]+q[2]))/2; b[n]=mm; )); for(ii=1, nn^2, print1(b[ii], ", ")); } // \\ If the desired a(n) in the output is 0, then one needs to increase the value of nn in lista(nn) until a(n) becomes positive. This program is a modification of the PARI program by Max Alekseyev in A082228. - Petros Hadjicostas, Feb 25 2021
proposed
editing
editing
proposed
editing
proposed
(PARI) lista(nn) = { A=matrix(nn, nn); my(b=vector(nn^2)); S=Set(); for(s=2, nn+1, for(i=1, s-1, if(s%2, q=[i, s-i], q=[s-i, i]); p=[sum(j=1, q[2]-1, A[q[1], j]), sum(j=1, q[1]-1, A[j, q[2]])]; n=1; while(setsearch(S, n) || (p[1]&&!isprime(p[1]+n)) || (p[2]&&isprime(p[2]+n)), n++); A[q[1], q[2]]=n; S=setunion(S, Set([n])); mm=(q[1]+q[2]-1)*(q[1]+q[2]-2)/2 + q[2]*(1 + (-1)^(q[1]+q[2]))/2 + q[1]*(1 - (-1)^(q[1]+q[2]))/2; b[n]=mm; )); for(ii=1, 100nn^2, print1(b[ii], ", ")); } // If the desired a(n) in the output is 0, then one needs to increase the value of nn in lista(nn) until a(n) becomes positive. This program is a modification of the PARI program by Max Alekseyev in A082228.- Petros Hadjicostas, Feb 25 2021