P586
projecteuler.net

Binary Quadratic Form

ℹ️Published on Saturday, 14th January 2017, 10:00 pm; Solved by 258;
Difficulty rating: 75%

The number $209$ can be expressed as $a^2 + 3ab + b^2$ in two distinct ways:

$ \qquad 209 = 8^2 + 3\cdot 8\cdot 5 + 5^2$
$ \qquad 209 = 13^2 + 3\cdot13\cdot 1 + 1^2$

Let $f(n,r)$ be the number of integers $k$ not exceeding $n$ that can be expressed as $k=a^2 + 3ab + b^2$, with $a \gt b \gt 0$ integers, in exactly $r$ different ways.

You are given that $f(10^5, 4) = 237$ and $f(10^8, 6) = 59517$.

Find $f(10^{15}, 40)$.



Soluzione

Last modified: May 01, 2025. Website built with Franklin.jl and the lovely Julia programming language.