OFFSET
1,4
COMMENTS
Number of monotone Bacher representations (A368207) of n. We call a ​quadruple (w, x, y, z) of nonnegative integers a monotone Bacher representation of n if and only if n = w*x + y*z and w <= x < y <= z.
LINKS
Roland Bacher, A quixotic proof of Fermat's two squares theorem for prime numbers, American Mathematical Monthly, Vol. 130, No. 9 (November 2023), 824-836; arXiv version, arXiv:2210.07657 [math.NT], 2023.
EXAMPLE
For n = 13, the 4 solutions are (w, x, y, z) = (0, 0, 1, 13), (1, 1, 2, 6), (1, 1, 3, 4), (2, 2, 3, 3).
MATHEMATICA
t[n_]:=t[n]=Select[Divisors[n], #^2<=n&];
A368276[n_]:=Total[t[n]]+Sum[Boole[wx<d*dx], {wx, Floor[n/2]}, {dx, t[wx]}, {d, t[n-wx]}];
Array[A368276, 100] (* Paolo Xausa, Jan 02 2024 *)
PROG
(Python)
from itertools import takewhile
from sympy import divisors
def A368276(n):
c = sum(takewhile(lambda x: x**2 <= n, divisors(n)))
for wx in range(1, (n >> 1) + 1):
for d1 in divisors(wx):
if d1**2 > wx:
break
m = n - wx
c += sum(1
for d in takewhile(lambda x: x**2 <= m, divisors(n - wx))
if wx < d * d1)
return c # Chai Wah Wu, Dec 19 2023
(Julia)
using Nemo
function A368276(n)
t(n) = (d for d in divisors(n) if d * d <= n)
sum(sum(sum(1 for d in t(n - wx) if wx < d * dx; init=0)
for dx in t(wx)) for wx in 1:div(n, 2); init=sum(t(n)))
end
println([A368276(n) for n in 1:74]) # Peter Luschny, Dec 19 2023
CROSSREFS
KEYWORD
nonn
AUTHOR
Peter Luschny, Dec 19 2023
STATUS
approved