OFFSET
1,7
COMMENTS
For the definition of 'Bacher representation' and related notions, see the comments in A368580.
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], 2022.
FORMULA
a(n) = Sum_{k in K} Sum_{w in W} Sum_{y in Y} max(1, 2*([w^2 < k] + [y^2 < n - k])), where the square brackets denote Iverson brackets and k in K <=> 1 <= k <= floor(n/2), w in W <=> w|k and w^2 <= k, and y in Y <=> y|n-k and y^2 <= n-k and k < y*w. (See the Julia implementation.)
a(p) = (p + 1) / 2 - 2 for all odd prime p.
EXAMPLE
See the example in A368580.
MATHEMATICA
t[n_]:=t[n]=Select[Divisors[n], #^2<=n&];
A368581[n_]:=Sum[If[wx<y*w, Max[1, 2(Boole[w^2<wx]+Boole[y^2<n-wx])], 0], {wx, Floor[n/2]}, {w, t[wx]}, {y, t[n-wx]}];
Array[A368581, 100] (* Paolo Xausa, Jan 02 2024 *)
PROG
(Julia)
using Nemo
function A368581(n::Int)
t(n) = (d for d in divisors(n) if d * d <= n)
c(y, w, wx) = max(1, 2 * (Int(w * w < wx) + Int(y * y < n - wx)))
sum(sum(sum(c(y, w, wx) for y in t(n - wx) if wx < y * w; init=0)
for w in t(wx)) for wx in 1:div(n, 2); init=0)
end
println([A368581(n) for n in 1:72])
CROSSREFS
KEYWORD
nonn
AUTHOR
Peter Luschny, Dec 31 2023
STATUS
approved