1Math::NumSeq::GoldbachCUosuenrt(C3o)ntributed Perl DocumMeanttha:t:iNounmSeq::GoldbachCount(3)
2
3
4

NAME

6       Math::NumSeq::GoldbachCount -- number of representations as sum of
7       primes P+Q
8

SYNOPSIS

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

DESCRIPTION

15       The number of ways each i can be represented as a sum of two primes
16       P+Q, starting from i=1,
17
18           0, 0, 0, 1, 1, 1, 1, 1, 1, 2, 0, 1, 1, 2, 1, 2, 0, ...
19           starting i=1
20
21       For example i=4 can be represented only as 2+2 so just 1 way.  Or i=10
22       is 3+7 and 5+5 so 2 ways.
23
24   Even Numbers
25       Option "on_values => 'even'" gives the count on just the even numbers,
26       starting i=1 for number of ways "2" can be expressed (none),
27
28           0, 1, 1, 1, 2, 1, 2, 2, 2, 2, 3, 3, 3, 2, 3, 2, 4, 4, ...
29           starting i=1
30
31       Goldbach's famous conjecture is that for an even i >= 4 there's always
32       at least one P+Q=i, which would be a count here always >= 1.
33
34   Odd Numbers
35       Odd numbers i are not particularly interesting.  An odd number can only
36       be i=2+Prime, so the count is simply
37
38           count(odd i) = 1  if i-2 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::GoldbachCount->new ()"
46       "$seq = Math::NumSeq::GoldbachCount->new (on_values => 'even')"
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 a sum of primes P+Q, or with the "on_values=>'even'"
53           option the number of ways for "2*$i".
54
55           This requires checking all primes up to $i (or "2*$i") 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
59       "$bool = $seq->pred($value)"
60           Return true if $value occurs as a count.  All counts 0 upwards
61           occur so this is simply integer "$value >= 0".
62

SEE ALSO

64       Math::NumSeq, Math::NumSeq::Primes, Math::NumSeq::LemoineCount,
65       Math::NumSeq::PrimeFactorCount
66

HOME PAGE

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

LICENSE

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