I wasn’t aware of this universal algorithm. Thank you for sharing it.

]]>You’re welcome! I made it hoping it would be useful.

]]>— –Enter x;

— calculate y and Zeta:

y = (x * x – k * k) / 2 * k;

z = y + k.

the parity of the coefficients coincides with the parity of x.

Apply the coefficients until they are exhausted:

2, 4 , 6, 8 … or 3. 5. 7 …….

If the player gets a non-natural number, take the following coefficient.

Not only triples are calculated)))

]]>