OFFSET
0,2
LINKS
David Radcliffe, Table of n, a(n) for n = 0..10000 (terms n = 0..155 from Indranil Ghosh).
FORMULA
From David Radcliffe, May 22 2025: (Start)
a(n) = (4*n+1)^2 iff n=0 or n+1 is an odd prime, otherwise a(n) > (4*n+1)^2.
a(n) = 8 * A280391(n) - 8*(2*n+1)^2 + (4*n+1)^2 for n>1. (End)
EXAMPLE
For n = 2, few of the possible matrices are [-2,-2,0,0], [-2,-1,0,0], [-2,0,-2,0], [-2,0,-1,0], [-2,0,0,0], [-2,0,1,0], [-2,0,2,0], [1,0,0,0], [1,0,1,0], [1,0,2,0], [1,1,0,0], [1,2,0,0], [2,-2,0,0], [2,-1,0,0], [2,0,-2,0], .... There are 81 possibilities. Here each of the matrices is defined as M = [a,b,c,d] where a = M[1][1], b = M[1][2], c = M[2][1], d = M[2][2]. So for n = 2, a(2)=81.
PROG
(Python)
def t(n):
s=0
for a in range(-n, n+1):
for b in range(-n, n+1):
for c in range(-n, n+1):
for d in range(-n, n+1):
if (a*d-b*c)*n==(a*d+b*c):
s+=1
return s
for i in range(0, 156):
print(t(i))
(Python)
import numpy as np
def a280417(N):
if N > 0: yield 1
if N > 1: yield 45
if N <= 2: return
prods = np.zeros(N * N, dtype=np.int32)
prods[1] = 1 # prods[k] counts integer solutions to x*y = k with 1 <= x, y <= n
for n in range(2, N):
n_sq = n * n
prods[n: n_sq: n] += 2
prods[n_sq] += 1
dx = (n + 1) // 2 if n % 2 else n + 1
dy = (n - 1) // 2 if n % 2 else n - 1
ad = prods[dx : n_sq : dx]
bc = prods[dy : dy * ad.shape[0] + 1 : dy]
yield (4 * n + 1) ** 2 + 8 * int(ad @ bc)
# (4*n+1)**2 = solutions to a*d = b*c = 0 with -n <= a, b <= n.
# ad @ bc = solutions to (n-1)*a*d = (n+1)*b*c > 0 with 1 <= a, b <= n.
# Multiply by 8 to account for all consistent sign changes of a, b, c, d.
print(list(a280417(44))) # David Radcliffe, May 22 2025
CROSSREFS
KEYWORD
nonn
AUTHOR
Indranil Ghosh, Jan 06 2017
STATUS
approved
