Math::N...indromes(3)

πŸ“¦
version 75 Β· 2 versions
, in fedora 43

πŸ’– 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 to next() will return $i and 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 $value is 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