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


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


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.


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.


Math::NumSeq, Math::NumSeq::Primes

Clifford Pickover, "The Grand Internet Obstinate Number Search"


Copyright 2010, 2011, 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 <>.