Math::N...rNumbers(3)

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

๐ŸŒŸ NAME ๐ŸŒŸ

Math::NumSeq::StarNumbers โ€” star numbers, aka 6*i*(i-1)+1 ๐Ÿ’ซ (this is the Perl user-contributed docs version, so hi bestie, you're in the right place ๐Ÿซถ)


โœจ SYNOPSIS โœจ

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

like, that's it. three lines and you're pulling star numbers out of thin air. iconic. ๐Ÿ‘‘


๐ŸŽ€ DESCRIPTION ๐ŸŽ€

Okay so this class gives you the sequence of star numbers โ€” and they go

1, 13, 37, 73, 121, etc

and the formula behind the whole thing is

6*i*(i-1)+1

they're also known as the centred 12-gonals, because geometry said "what if a polygon but make it a star" and honestly? it ate. โญ


๐Ÿ’… FUNCTIONS ๐Ÿ’…

heads up bestie, for all the behaviour that every sequence class shares, go read "FUNCTIONS" in Math::NumSeq. this page is just the star-number-specific lore. ๐ŸŒธ

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

๐Ÿ”ฎ Random Access ๐Ÿ”ฎ

  • $value = $seq->ith($i) โ€” gimme the value at index $i, and it returns you exactly 6*$i*($i-1)+1. literally just that. ๐Ÿ’–
  • $bool = $seq->pred($value) โ€” the vibe check ๐Ÿ•ต๏ธโ™€๏ธ: returns true if $value can be written as 6*i*(i-1)+1 for some i. if it can't, it's not a star number, sorry babe. ๐Ÿ’€
  • $i = $seq->value_to_i_floor($value)
  • $i = $seq->value_to_i_estimate($value) โ€” these two both return the i for the star number that's <= $value. yes, both of them. they're listed together like that. ๐Ÿซถ

๐Ÿ‘€ SEE ALSO ๐Ÿ‘€

  • Math::NumSeq
  • Math::NumSeq::Polygonal

go read those too, they're the whole extended universe. ๐ŸŒˆ


๐Ÿ  HOME PAGE ๐Ÿ 

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

that's the house this whole thing lives in. โœจ


๐Ÿ“œ 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 that's the whole page, mwah ๐Ÿ’‹ this was perl v5.42.0, dated 2025-07-25, and the page is Math::NumSeq::StarNumbers(3) โ€” go forth and compute star numbers, bestie, you got this ๐Ÿ’œ๐Ÿงš

๐Ÿ“ฆ where this page comes from