Math::NumSeq::Odd(3)

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

πŸ’… Math::NumSeq::Odd

okay bestie, so this is the manual page for Math::NumSeq::Odd from the User Contributed Perl Documentation section (section 3, the library-calls one, iykyk) πŸŽ€


✨ NAME ✨

Math::NumSeq::Odd β€” odd integers πŸ’œ

like. the odd ones. 1, 3, 5. not the even ones. we don't do those here (that's a different module, see SEE ALSO below, no spoilers 🫢)


🌸 SYNOPSIS 🌸

use Math::NumSeq::Odd;
my $seq = Math::NumSeq::Odd->new;
my ($i, $value) = $seq->next;

that's literally it. three lines and you're off. iconic behaviour tbh ⭐


πŸ¦‹ DESCRIPTION πŸ¦‹

The odd integers, bestie:

1, 3, 5, 7, 9, 11, ...
starting i=0

so i=0 gives you 1, i=1 gives you 3, and so on forever. it's giving "infinite" and honestly? obsessed 🌈


πŸŽ€ FUNCTIONS πŸŽ€

for the stuff that every single sequence class does the same way, go read "FUNCTIONS" in Math::NumSeq. that's the shared lore. πŸ’–

  • $seq = Math::NumSeq::Odd->new () β€” makes you a brand new sequence object and hands it back to you. fresh out the box, no cap.

πŸ”₯ Iterating

  • $seq->seek_to_i($i) β€” moves where you are in the sequence over to $i. the very next time you call next() it's gonna hand you $i and the value that goes with it. main character energy, you decide where the story starts ✨
  • $seq->seek_to_value($value) β€” nudges the current i around so that next() spits out $value when you call it. but β€” and this is the lil plot twist πŸ™ˆ β€” if $value happens to be an even integer, then you get the next higher even one instead. not a bug, just the vibe.

πŸ’€ Random Access

  • $value = $seq->ith($i) β€” returns 2*$i + 1. that's the whole trick. multiply by two, add one, boom, odd number πŸ’…
  • $bool = $seq->pred($value) β€” returns true if $value is odd. that's it. that's the predicate. no notes.
  • $i = $seq->value_to_i_ceil($value)
  • $i = $seq->value_to_i_floor($value)

both of these return (value-1)/2, except one rounds up and one rounds down to the next integer. ceil goes up, floor goes down. you got this 🧚

  • $i = $seq->value_to_i_estimate($value) β€” gives you an estimate of the i that corresponds to $value. it's an estimate, bestie, not a promise πŸ“

🌟 SEE ALSO 🌟

  • Math::NumSeq
  • Math::NumSeq::Even
  • Math::NumSeq::All

(the whole friend group 🫢)


πŸ‘‘ HOME PAGE πŸ‘‘

<http://user42.tuxfamily.org/math-numseq/index.html>

go say 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/>.

ok so real talk: that "WITHOUT ANY WARRANTY" bit is not a joke, bestie β€” no promises, no guarantees, use it at your own risk πŸ’€ and if you didn't get your copy of the GPL with the module, go grab it at <http://www.gnu.org/licenses/>. periodt.

and that's the whole page, babe πŸŽ€ perl v5.42.0, dated 2025-07-25, page Math::NumSeq::Odd(3) β€” slay, stan, and go count some odd numbers πŸ’œβœ¨πŸ¦‹

πŸ“¦ where this page comes from