Math::N...indromes(3)
π Math::N...indromes β the manual page, but make it cute
okay so real talk, this is Math::N...indromes(3), a User Contributed Perl Documentation page, and bestie we are about to get so into palindromes. buckle up π
β¨ NAME β¨
Math::NumSeq::Palindromes β palindrome numbers like 15351 π
likeβ¦ numbers that read the exact same forwards and backwards. iconic behaviour. no notes. π
πΈ SYNOPSIS πΈ
use Math::NumSeq::Palindromes;
my $seq = Math::NumSeq::Palindromes->new;
my ($i, $value) = $seq->next;
three lines. that's it. that's the whole vibe. β¨
π¦ DESCRIPTION π¦
The palindrome numbers which read the same backwards and forwards. literally the "never gonna give you up" of digits, they refuse to be different in reverse. ππ
0 .. 9, 11, 22, ..., 99, 101, 111, 121, ... 191, 202, ...
# starting i=1 value=0
okay so important detail: the default is decimal, but you can pass the "radix" parameter to select another base. mix it up, choose your own numeral system, be the main character of base-7. π
π₯ FUNCTIONS π₯
head over to "FUNCTIONS" in Math::NumSeq for behaviour common to all sequence classes β that's the shared lore, iykyk. π
$seq = Math::NumSeq::Palindromes->new ()$seq = Math::NumSeq::Palindromes->new (radix => $r)
Create and return a new sequence object. brand new baby sequence, fresh out the box π«Ά (and yeah, that second form is where you sneak in your $r radix.)
π§ Iterating
$seq->seek_to_i($i)β Move the current sequence position to$i. The next call tonext()will return$iand corresponding value. it's giving teleportation, honestly β¨
π Random Access
$value = $seq->ith($i)β Return the$i'th palindrome number. no walking the whole list, just straight to the goods π$bool = $seq->pred($value)β Return true if$valueis a palindrome, ie. its digits read the same forwards and backwards (in the given"radix"). vibe check on a single number, and it passes or it doesn't π
π SEE ALSO π
- Math::NumSeq
- Math::NumSeq::Repdigits
the friend group. go say hi. π«Ά
π HOME PAGE π
<http://user42.tuxfamily.org/math-numseq/index.html>
the mothership. the lore archive. the link is right there bestie β
π LICENSE π
Copyright 2010, 2011, 2012, 2013, 2014, 2016, 2019, 2020, 2021 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/>.
ok so the all-caps WARRANTY bit? that's not me being dramatic for the bit, that is genuinely the legal text and it genuinely means no promises. fr fr. π
and that's a wrap on this one!! π brought to you by perl v5.42.0, dated 2025-07-25, filed under Math::N...indromes(3) β mwah, go read the docs, ily, bye πβ¨π
π¦ 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