How to resolve the algorithm De Polignac numbers step by step in the Quackery programming language

Published on 12 May 2024 09:40 PM

How to resolve the algorithm De Polignac numbers step by step in the Quackery programming language

Table of Contents

Problem Statement

Alphonse de Polignac, a French mathematician in the 1800s, conjectured that every positive odd integer could be formed from the sum of a power of 2 and a prime number. He was subsequently proved incorrect. The numbers that fail this condition are now known as de Polignac numbers. Technically 1 is a de Polignac number, as there is no prime and power of 2 that sum to 1. De Polignac was aware but thought that 1 was a special case. However. 127 is also fails that condition, as there is no prime and power of 2 that sum to 127. As it turns out, de Polignac numbers are not uncommon, in fact, there are an infinite number of them.

Let's start with the solution:

Step by Step solution about How to resolve the algorithm De Polignac numbers step by step in the Quackery programming language

Source code in the quackery programming language

  [ true swap
    1 from
      [ index over > iff
          end done
        dup index -
        isprime if
          [ dip not end ]
        index incr ]
    drop ]                is depolignac ( n --> b )

  [] 1 from
    [ index depolignac if
        [ index join ]
      dup size 50 = if 
        end
      2 incr ]
  echo

  

You may also check:How to resolve the algorithm Circular primes step by step in the Delphi programming language
You may also check:How to resolve the algorithm 99 bottles of beer step by step in the ProDOS programming language
You may also check:How to resolve the algorithm XML/Output step by step in the Clojure programming language
You may also check:How to resolve the algorithm Emirp primes step by step in the Haskell programming language
You may also check:How to resolve the algorithm Roots of a quadratic function step by step in the ERRE programming language