I am working on a project in PHP where I generate a number and want to see if said number is part of the A002620 sequence. I've started by looking at https://oeis.org/A002620 "Quarter-squares: floor(n/2)*ceiling(n/2). Equivalently, floor(n^2/4)."
I am confused how to implement, If I do floor(n^2/4)
it proves nothing (below). I am a developer with basic Math so if someone could explain the process.
<?php
$start_num = 9;
$sum = floor($start_num**2/4);
echo $sum;
//result 20
?>
At the given A002620 you find the following explicit formula for $a(n)$: $$a(n)={1\over8}\bigl(2n^2-1+(-1)^n\bigr)\qquad(n\geq0)\ .\tag{1}$$ This leads to the sequence $$0, 0, 1, 2, 4, 6, 9, 12, 16, 20, 25, 30, 36, 42, 49, 56, 64, 72, 81, \ 90, 100 \ldots$$ When the number $a(n)=:a$ is given we immediately obtain from $(1)$ that $$n^2=4a+{1-(-1)^n\over2}\ .\tag{2}$$ Now it seems that you have arbitrary numbers $N\in{\mathbb N}$ and want to know whether this $N$ is an $a(n)$. From $(2)$ we can deduce the following: