Sunday, March 6, 2011

Prime numbers that are pairs

A couple of pairs prime numbers is made up of two prime numbers that have distance 2 (e.g. (2,5), (5, 7), (11, 13)). How would you generate all the couples of pair prime numbers?

1 comment:

  1. It is a small bug in your question description: (2,5) have a distance of 3, believe it should have been (3,5).

    My python solution can be found on:
    https://github.com/atbrox/primepairs/

    ReplyDelete