Math::N...:Squares(3)
๐ Math::N...:Squares(3) โ user contributed perl documentation, bestie edition ๐
okay so this page lives in the User Contributed Perl Documentation corner of the perl manual universe, and it's all about Math::NumSeq::Squares โ the perfect squares sequence. yes, THE squares. the ones you learned in like third grade and never emotionally recovered from. let's go ๐
โจ NAME โจ
Math::NumSeq::Squares โ perfect squares, no cap ๐ช
๐ SYNOPSIS ๐
use Math::NumSeq::Squares;
my $seq = Math::NumSeq::Squares->new;
my ($i, $value) = $seq->next;
that's it. that's the whole vibe. make the object, pull numbers out of it, slay. ๐
๐ฆ DESCRIPTION ๐ฆ
it's the sequence of squares, aka i**2, and it goes a lil something like:
0, 1, 4, 9, 16, 25, ... (A000290)
the way that A000290 is just right there being its iconic OEIS self ๐ญ๐
๐ FUNCTIONS ๐
heads up bestie โ for the behaviour that's common to all the sequence classes, go read "FUNCTIONS" in Math::NumSeq. this page is just the squares-specific stuff. ๐ซถ
$seq = Math::NumSeq::Squares->new ()โ creates and hands you back a shiny new sequence object. fresh out the box, zero notes. โจ
๐ง Iterating
$seq->seek_to_i($i)โ scoots the current sequence position over to$i. then the very next call tonext()is gonna hand you$iand its matching value. like fast-forwarding to your fave part of the song. ๐ง$seq->seek_to_value($value)โ moves the current position so thatnext()gives you$valueon the next call. BUT โ and this is the plot twist โ if$valueisn't actually a square, then you get the next square above$valueinstead. the audacity. the drama. ๐
๐ฅ Random Access
$value = $seq->ith($i)โ returns"$i * $i". simple. elegant. iconic.$bool = $seq->pred($value)โ returns true if$valueis a square, i.e.k*kfor some integerk. vibe check: passed or not passed, no in-between. ๐$i = $seq->value_to_i_ceil($value)โ returns the square root of$value, rounded up to the next integer. โฌ๏ธ$i = $seq->value_to_i_floor($value)โ returns the square root of$value, rounded down to the next integer. โฌ๏ธ$i = $seq->value_to_i_estimate($value)โ returns an estimate of theithat corresponds to$value. an educated guess, a lil peek into the future, we love her. ๐ฎ
๐ธ SEE ALSO ๐ธ
Math::NumSeqMath::NumSeq::PronicMath::NumSeq::TriangularMath::NumSeq::Cubes
the whole squad fr fr ๐ซถ๐ฆ
๐ HOME PAGE ๐
<http://user42.tuxfamily.org/math-numseq/index.html>
go visit, she's gorgeous, tell her i said hi ๐
๐ LICENSE ๐
Copyright 2010, 2011, 2012, 2013, 2014, 2016, 2019, 2020 Kevin Ryde
Math-NumSeq is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 3, or (at your option) any later version.
Math-NumSeq is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.
You should have received a copy of the GNU General Public License along with Math-NumSeq. If not, see <http://www.gnu.org/licenses/>.
no warranty bestie, the lawyers made me say it ๐ญ read the GPL, it's giving legally binding main character energy ๐
and that's the whole page!! ๐ this was perl v5.42.0, dated 2025-07-25, straight from the Math::N...:Squares(3) page โ mwah, bye, go square something ๐งโจ
๐ฆ where this page comes from
- fedora 43: perl-Math-NumSeq 75-11.fc43 ยท GPL-3.0-or-later
- ๐ girlified by deepseek-ai/DeepSeek-V4.1-Flash on : a language model's rewrite of the original, under its terms