++ed by:
Kevin Ryde
and 1 contributors

# NAME

Math::NumSeq::PolignacObstinate -- odd integers not prime+2^k

# SYNOPSIS

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

# DESCRIPTION

This sequence is integers which cannot be represented as prime+2^k for an integer k. These are counter-examples to a conjecture by Prince de Polignac that every odd integer occurs as prime+2^k (and are called "obstinate" numbers by Andy Edwards).

``    1, 127, 149, 251, 331, 337, ...``

For example 149 is obstinate because it cannot be written as prime+2^k. Working backwards, it can be seen that none of 149-1, 149-2, 149-4, 149-8, ... 149-128 are primes.

A theorem by Erdos gives infinitely many such obstinate integers (in an arithmetic progression).

The value 3 is not in the sequence because it can be written prime+2^k, for prime=2 and k=0.

# FUNCTIONS

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

`\$seq = Math::NumSeq::PolignacObstinate->new ()`

Create and return a new sequence object.

`\$bool = \$seq->pred(\$value)`

Return true if `\$value` is obstinate, ie. that there's no `\$k >= 0` for which `\$value - 2**\$k` is a prime.

This check requires prime testing up to `\$value` and in the current code a hard limit of 2**32 is placed on the `\$value` to be checked, in the interests of not going into a near-infinite loop.