# NAME

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

# SYNOPSIS

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

# DESCRIPTION

This is a count of how many ways i can be represented as P+2*Q for primes P,Q, starting from i=1.

``````    0, 0, 0, 0, 0, 1, 1, 1, 2, 0, 2, 1, 2, 0, 2, 1, 4, 0, ...
starting i=1``````

For example i=6 can only be written 2+2*2 so just 1 way. But i=9 is 3+2*3=9 and 5+2*2=9 so 2 ways.

## Odd Numbers

Option `on_values => 'odd'` gives the count on just the odd numbers, starting i=0 for number of ways "1" can be expressed (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 that all odd i >= 7 can be represented as P+2*Q, which would be a count here always >=1.

## Even Numbers

Even numbers i are not particularly interesting. An even number must have P even, ie. P=2, so i=2+2*Q for count

``````    count(even i) = 1 if i/2-1 is prime
= 0 if not``````

# FUNCTIONS

See "FUNCTIONS" in Math::NumSeq for behaviour common to all sequence classes.

`\$seq = Math::NumSeq::LemoineCount->new ()`
`\$seq = Math::NumSeq::LemoineCount->new (on_values => 'odd')`

Create and return a new sequence object.

## Random Access

`\$value = \$seq->ith(\$i)`

Return the sequence value at `\$i`, being the number of ways `\$i` can be represented as P+2*Q for primes P,Q. or with the `on_values=>'odd'` option the number of ways for `2*\$i+1`.

This requires checking all primes up to `\$i` or `2*\$i+1` and the current code has a hard limit of 2**24 in the interests of not going into a near-infinite loop.