1Math::NumSeq::LemoineCoUusnetr(3C)ontributed Perl DocumeMnattaht:i:oNnumSeq::LemoineCount(3)
2
3
4

NAME

6       Math::NumSeq::LemoineCount -- number of representations as P+2*Q for
7       primes P,Q
8

SYNOPSIS

10        use Math::NumSeq::LemoineCount;
11        my $seq = Math::NumSeq::LemoineCount->new;
12        my ($i, $value) = $seq->next;
13

DESCRIPTION

15       This is a count of how many ways i can be represented as P+2*Q for
16       primes P,Q, starting from i=1.
17
18           0, 0, 0, 0, 0, 1, 1, 1, 2, 0, 2, 1, 2, 0, 2, 1, 4, 0, ...
19           starting i=1
20
21       For example i=6 can only be written 2+2*2 so just 1 way.  But i=9 is
22       3+2*3=9 and 5+2*2=9 so 2 ways.
23
24   Odd Numbers
25       Option "on_values => 'odd'" gives the count on just the odd numbers,
26       starting i=0 for number of ways "1" can be expressed (none),
27
28           0, 0, 0, 1, 2, 2, 2, 2, 4, 2, 3, 3, 3, 4, 4, 2, 5, 3, 4, ...
29           starting i=0
30
31       Lemoine conjectured circa 1894 that all odd i >= 7 can be represented
32       as P+2*Q, which would be a count here always >=1.
33
34   Even Numbers
35       Even numbers i are not particularly interesting.  An even number must
36       have P even, ie. P=2, so i=2+2*Q for count
37
38           count(even i) = 1 if i/2-1 is prime
39                         = 0 if not
40

FUNCTIONS

42       See "FUNCTIONS" in Math::NumSeq for behaviour common to all sequence
43       classes.
44
45       "$seq = Math::NumSeq::LemoineCount->new ()"
46       "$seq = Math::NumSeq::LemoineCount->new (on_values => 'odd')"
47           Create and return a new sequence object.
48
49   Random Access
50       "$value = $seq->ith($i)"
51           Return the sequence value at $i, being the number of ways $i can be
52           represented as P+2*Q for primes P,Q. or with the "on_values=>'odd'"
53           option the number of ways for "2*$i+1".
54
55           This requires checking all primes up to $i or "2*$i+1" and the
56           current code has a hard limit of 2**24 in the interests of not
57           going into a near-infinite loop.
58

SEE ALSO

60       Math::NumSeq, Math::NumSeq::Primes, Math::NumSeq::GoldbachCount
61

HOME PAGE

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

LICENSE

66       Copyright 2012, 2013, 2014, 2016, 2019 Kevin Ryde
67
68       Math-NumSeq is free software; you can redistribute it and/or modify it
69       under the terms of the GNU General Public License as published by the
70       Free Software Foundation; either version 3, or (at your option) any
71       later version.
72
73       Math-NumSeq is distributed in the hope that it will be useful, but
74       WITHOUT ANY WARRANTY; without even the implied warranty of
75       MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
76       General Public License for more details.
77
78       You should have received a copy of the GNU General Public License along
79       with Math-NumSeq.  If not, see <http://www.gnu.org/licenses/>.
80
81
82
83perl v5.34.0                      2021-07-22     Math::NumSeq::LemoineCount(3)
Impressum