Math::N...nNumbers(3)

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

πŸ’– Math::NumSeq::CullenNumbers πŸ’–

okay bestie, so this is a page from the User Contributed Perl Documentation, and it's all about Math::NumSeq::CullenNumbers β€” the Cullen numbers, which are genuinely so iconic for no reason. let's get into it πŸ¦‹


✨ NAME ✨

Math::NumSeq::CullenNumbers β€” Cullen numbers i*2^i+1

like. the name is the whole vibe. Cullen numbers. i*2^i+1. that's her. πŸ‘‘


🌸 SYNOPSIS 🌸

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

so you pull in the module, you make a new sequence object, and then you just keep calling ->next and it hands you back a pair of ($i, $value). it's giving "infinite little snack dispenser" fr fr πŸ“


πŸ’… DESCRIPTION πŸ’…

The Cullen numbers are i*2^i+1, and the sequence starts from i=0, so you get:

1, 3, 9, 25, 65, 161, 385, 897, 2049, 4609, 10241, ...

look at those numbers. they're growing. they're thriving. main character energy honestly ✨


πŸŽ€ FUNCTIONS πŸŽ€

heads up bestie: for the behaviour that's common to all the sequence classes, go read "FUNCTIONS" in Math::NumSeq. that's the shared lore. this page is just the Cullen-specific stuff πŸ’œ
  • $seq = Math::NumSeq::CullenNumbers->new () β€” creates a brand new sequence object and hands it back to you. new object, new era, slay.

πŸ”₯ Random Access πŸ”₯

  • $value = $seq->ith($i) β€” returns "$i * 2**$i + 1". you ask for the i-th one, it gives you the i-th one. no notes. πŸ’–
  • $bool = $seq->pred($value) β€” returns true if $value is a Cullen number, ie. it's equal to i*2^i+1 for some i. it's basically the vibe check for "are you one of us" 🫢
  • $i = $seq->value_to_i_estimate($value) β€” returns an estimate of the i that corresponds to $value. note the word estimate, bestie. it's an estimate. don't come for her. 😭

🌈 FORMULAS 🌈

✨ Value to i Estimate ✨

see "Value to i Estimate" in Math::NumSeq::WoodallNumbers. yeah it points at the Woodall page, they're cousins, it's a whole family thing, iykyk πŸ’€


πŸ‘‘ SEE ALSO πŸ‘‘

  • Math::NumSeq
  • Math::NumSeq::WoodallNumbers

πŸ¦‹ HOME PAGE πŸ¦‹

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


🧚 LICENSE 🧚

Copyright 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/>.

⚠️ okay so the all-caps parts are doing a LOT of heavy lifting here β€” no warranty, no merchantability, no fitness for a particular purpose. that's the legal equivalent of "not my problem" and it is very much on purpose. read it, respect it, don't skip it πŸ™ˆ

and that's the whole page, bestie! πŸ’– this one's from perl v5.42.0, dated 2025-07-25, and it's filed under Math::NumSeq::CullenNumbers(3) in section 3 of the manual. go forth and enumerate some Cullen numbers, you absolute icon πŸŽ€βœ¨

πŸ“¦ where this page comes from