user
Twin primes are pairs of natural numbers   (P1  and  P2)   that satisfy the following:

:   :   1. P1   and   P2   are primes
        2. P1  +  **2**   =   P2

Task

Write a program that displays the number of **pairs of twin primes** that can be found under a user-specified number
  
(P1 < *user-specified number* & P2 < *user-specified number*).

Extension
:   :   1. Find all twin prime pairs under 100000, 10000000 and 1000000000.
        2. What is the time complexity of the program? Are there ways to reduce computation time?

Examples

```
> Search Size: 100
> 8 twin prime pairs.

```

```
> Search Size: 1000
> 35 twin prime pairs.

```

Also see

* The OEIS entry: A001097: Twin primes.
* The OEIS entry: A167874: The number of distinct primes < 10^n which are members of twin-prime pairs.
* The OEIS entry: A077800: List of twin primes {p, p+2}, with repetition.
* The OEIS entry: A007508: Number of twin prime pairs below 10^n.
assistant
**Works with**: Rakudo version 2020.07

```
use Lingua::EN::Numbers;

use Math::Primesieve;

my $p = Math::Primesieve.new;

printf "Twin prime pairs less than %17s: %s\n", comma(10**$_), comma $p.count(10**$_, :twins) for 1 .. 12;
say (now - INIT now).round(.01) ~ ' seconds';

```

Output:

```
Twin prime pairs less than                10: 2
Twin prime pairs less than               100: 8
Twin prime pairs less than             1,000: 35
Twin prime pairs less than            10,000: 205
Twin prime pairs less than           100,000: 1,224
Twin prime pairs less than         1,000,000: 8,169
Twin prime pairs less than        10,000,000: 58,980
Twin prime pairs less than       100,000,000: 440,312
Twin prime pairs less than     1,000,000,000: 3,424,506
Twin prime pairs less than    10,000,000,000: 27,412,679
Twin prime pairs less than   100,000,000,000: 224,376,048
Twin prime pairs less than 1,000,000,000,000: 1,870,585,220
6.89 seconds
```