Math::N...:Pronic(3)

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

πŸ’– Math::NumSeq::Pronic β€” the manual, but make it cute πŸ’–

okay so bestie, you found the page for Math::NumSeq::Pronic πŸ’… it lives in the User Contributed Perl Documentation corner of the perl universe, and it is literally just about pronic numbers. yes that's a real word. yes it's iconic. let's go πŸ¦‹


✨ NAME ✨

Math::NumSeq::Pronic β€” pronic numbers πŸ“


🌸 SYNOPSIS 🌸

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

that's it. that's the whole vibe check. build the sequence, pull numbers out one at a time, slay ✨


πŸŽ€ DESCRIPTION πŸŽ€

so the pronic numbers are the ones you get from i*(i+1). no cap.

0, 2, 6, 12, 20, 30, ...
starting i=0

and here's the tea β˜• these are twice the triangular numbers, and they sit half way between the perfect squares. main character geometry fr fr πŸ’œ


πŸ‘‘ FUNCTIONS πŸ‘‘

for the behaviour that every single sequence class shares, go peek at "FUNCTIONS" in Math::NumSeq. that's the group chat everyone's in πŸ’¬

  • $seq = Math::NumSeq::Pronic->new () β€” make a brand new sequence object and hand it back to you. born fresh, zero notes 🫢

🌈 Iterating

  • $seq->seek_to_i($i) β€” move the current sequence position to $i. the next time you call next(), it'll give you back $i and the matching value. literally just fast-forwarding your playlist to the right track 🎧
  • $seq->seek_to_value($value) β€” move the current position so that next() hands you $value on the next call. and if $value isn't actually a pronic number? no worries, you get the next pronic one above $value. rounding up, always up, we don't do down here πŸ’…

⭐ Random Access

  • $value = $seq->ith($i) β€” returns "$i*($i+1)". cute, simple, does exactly what it says on the tin πŸŽ€
  • $bool = $seq->pred($value) β€” true if $value is a pronic number, meaning i*(i+1) for some i. it's the "are you one of us" check πŸ”₯
  • $i = $seq->value_to_i_ceil($value)
  • $i = $seq->value_to_i_floor($value)

these two give you the $i index of $value, rounding up or down if $value isn't a pronic number. pick your fighter ⬆️⬇️

  • $i = $seq->value_to_i_estimate($value) β€” an estimate of the i that goes with $value. the formula value=i*(i+1) gets inverted like this:
$i = int( (sqrt(4*$value + 1) - 1)/2 )

math girlies rise 😭✨


πŸ’œ SEE ALSO πŸ’œ

Math::NumSeq, Math::NumSeq::Squares, Math::NumSeq::Triangular πŸ¦‹


🌸 HOME PAGE 🌸

<http://user42.tuxfamily.org/math-numseq/index.html> β€” go visit, it's giving cozy 🏠


πŸ“œ LICENSE πŸ“œ

Copyright 2010, 2011, 2012, 2013, 2014, 2016, 2017, 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/>.

⚠️ okay important heads-up bestie: that WITHOUT ANY WARRANTY bit is real and it means real. no promises, no guarantees, not even the implied ones for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. read the license, it's the whole point πŸ”₯

and that's the whole page, you ate it, periodt πŸ’…βœ¨

this iconic little page shipped with perl v5.42.0 and was dated 2025-07-25 β€” mwah, bye bestie, go compute some pronic numbers πŸ«ΆπŸ’–

πŸ“¦ where this page comes from