Math::N...Numbers(3)

๐Ÿ“ฆ
version 75 ยท 2 versions
, in fedora 43

๐Ÿ’– NAME ๐Ÿ’–

Math::NumSeq::WoodallNumbers โ€” bestie, it's literally the Woodall numbers, aka i*2^i-1, and yes she's iconic ๐Ÿ’…

This page lives in the User Contributed Perl Documentation section, section 3 of the manual, and we're about to have the cutest little math moment together ๐Ÿงš


โœจ SYNOPSIS โœจ

okay so first things first, you load her up and she starts feeding you numbers:

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

that's it. that's the whole vibe. ๐Ÿฆ‹


๐ŸŒธ DESCRIPTION ๐ŸŒธ

The Woodall numbers are i*2^i-1, and the sequence starts from i=1, no cap:

1, 7, 23, 63, 159, 383, 895, 2047, 4607, 10239, ...

look at them go ๐Ÿ˜ญ she's serving numbers fr fr.


๐Ÿ‘‘ FUNCTIONS ๐Ÿ‘‘

see "FUNCTIONS" in Math::NumSeq for the behaviour common to all sequence classes โ€” that's the group chat everybody's in ๐Ÿ’œ

  • "$seq = Math::NumSeq::WoodallNumbers->new ()" โ€” creates and returns a brand new sequence object. new bestie, who dis ๐ŸŽ€

๐Ÿฆ‹ Iterating ๐Ÿฆ‹

  • "$seq->seek_to_i($i)" โ€” moves the current sequence position to $i. the very next call to next() will hand you back $i and its corresponding value. it's giving teleportation โœจ

๐Ÿ’… Random Access ๐Ÿ’…

  • "$value = $seq->ith($i)" โ€” returns "$i * 2**$i - 1". that's the formula, she said what she said.
  • "$bool = $seq->pred($value)" โ€” returns true if $value is a Woodall number, ie. if it's equal to i*2^i-1 for some i. vibe check: passed or not ๐ŸŒˆ
  • "$i = $seq->value_to_i_floor($value)" โ€” returns the index i of $value, or the index of the next Woodall number below $value. floor queen ๐Ÿ‘‘
  • "$i = $seq->value_to_i_estimate($value)" โ€” returns an estimate of the i corresponding to $value. not exact, just a guess, and honestly same ๐Ÿ˜ญ

๐Ÿงฎ FORMULAS ๐Ÿงฎ

โญ Value to i Estimate โญ

An easy over-estimate is l=log2(value), which reverses value=2^l. It can be reduced by the bit length of that l as i=l-log2(l) to get closer. math ate that fr fr ๐Ÿ”ฅ


๐Ÿซถ SEE ALSO ๐Ÿซถ

  • Math::NumSeq
  • Math::NumSeq::CullenNumbers
  • Math::NumSeq::ProthNumbers

the whole friend group ๐Ÿ’–


๐ŸŒˆ 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/>.

not the "no warranty" part bestie, that one's serious โ€” if it breaks, it breaks, and nobody's coming to fix it for you ๐Ÿ’€

and that's the whole page, periodt ๐ŸŽ€ this was perl v5.42.0, dated 2025-07-25, and she's still out here being Math::N...Numbers(3) like the icon she is ๐Ÿ’…โœจ stay slaying, bestie ๐Ÿ’–

๐Ÿ“ฆ where this page comes from