Hexagonal Number Checker
Check whether a nonnegative integer is a hexagonal number k(2k-1).
Description
Check whether a nonnegative integer has the form n(2n-1) for an integer index n.
Hexagonal Number Checker check whether a nonnegative integer has the form n(2n-1) for an integer index n.
Use this for figurate-number exercises, integer-sequence validation, and testing candidate hexagonal numbers.
When to use Hexagonal Number Checker
Use this for figurate-number exercises, integer-sequence validation, and testing candidate hexagonal numbers.
How it works
The inverse discriminant 8x+1 must be a perfect square whose square root is congruent to 3 modulo 4.1
Interpreting the result
Keep the input units, direction conventions, encoding, and ordering rules visible when reusing the result. Preserve the full returned value for downstream calculations and round only for presentation.
Assumptions and limitations
This uses the convention that zero is not selected by the positive-index congruence test, even though some extended sequences include an index-zero term.
References
-
The On-Line Encyclopedia of Integer Sequences — OEIS Foundation