Math::N...neCount(3)
π Math::N...neCount(3) π
okay so bestie, this page lives in the User Contributed Perl Documentation section, and its full name is Math::N...neCount(3) (yes the name is truncated in the header, that's just how it's filed, don't come for me). The real star here is Math::NumSeq::LemoineCount. Buckle up. π
β¨ NAME β¨
Math::NumSeq::LemoineCount β the number of ways something can be written as P+2*Q for primes P,Q. that's it, that's the whole vibe π¦
β¨ SYNOPSIS β¨
use Math::NumSeq::LemoineCount;
my $seq = Math::NumSeq::LemoineCount->new;
my ($i, $value) = $seq->next;
three lines, no drama, iconic behavior π
β¨ DESCRIPTION β¨
So the whole thing is a count of how many ways i can be represented as P+2*Q for primes P,Q, and it starts from i=1. Periodt.
0, 0, 0, 0, 0, 1, 1, 1, 2, 0, 2, 1, 2, 0, 2, 1, 4, 0, ...
starting i=1
like, let's actually walk through it, because the numbers go crazy:
i=6can only be written2+2*2, so it's just 1 way. lowkey minimal.- but
i=9is3+2*3=9and5+2*2=9, so that's 2 ways. she's flexible, she contains multitudes β¨
πΈ Odd Numbers πΈ
Option "on_values => 'odd'" gives you the count on just the odd numbers, and here it starts at i=0 for the number of ways "1" can be expressed β which is none. π
0, 0, 0, 1, 2, 2, 2, 2, 4, 2, 3, 3, 3, 4, 4, 2, 5, 3, 4, ...
starting i=0
Lemoine conjectured circa 1894 β yes, 1894, the man was ahead of his time, main character energy fr β that all odd i >= 7 can be represented as P+2*Q, which would mean the count here is always >=1. not proven, just conjectured. we stan a hopeful king π
πΈ Even Numbers πΈ
Even numbers i are not particularly interesting. ngl they're giving background character. An even number must have P even, ie. P=2, so i=2+2*Q, for a count of:
count(even i) = 1 if i/2-1 is prime
= 0 if not
that's the whole even plotline. short arc. π
β¨ FUNCTIONS β¨
peep "FUNCTIONS" in Math::NumSeq for the behaviour that's common to all sequence classes, bestie, that's the shared lore.
$seq = Math::NumSeq::LemoineCount->new ()$seq = Math::NumSeq::LemoineCount->new (on_values => 'odd')
Create and return a new sequence object. fresh out the box, no cap π«Ά
π Random Access π
$value = $seq->ith($i)β Return the sequence value at$i, being the number of ways$ican be represented asP+2*Qfor primesP,Q. Or, with the"on_values=>'odd'"option, the number of ways for"2*$i+1".
okay heads up bestie, this one requires checking all primes up to$ior"2*$i+1", and the current code has a hard limit of2**24β in the interests of not going into a near-infinite loop. so don't go past it, she will simply not. π
β¨ SEE ALSO β¨
Math::NumSeqMath::NumSeq::PrimesMath::NumSeq::GoldbachCount
the whole friend group, go say hi π
β¨ HOME PAGE β¨
<http://user42.tuxfamily.org/math-numseq/index.html>
β¨ LICENSE β¨
Copyright 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/>.
no warranty bestie, it's giving "use at your own risk" but make it legally binding π
and that's the page!! πβ¨ this was perl v5.42.0, dated 2025-07-25, filed under Math::N...neCount(3) β love her, read her, represent your primes as P+2*Q, mwah π
π¦ where this page comes from
- fedora 43: perl-Math-NumSeq 75-11.fc43 Β· GPL-3.0-or-later
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash on : a language model's rewrite of the original, under its terms