# De Polignac numbers

```ruby
var polignacs = (1..Inf -> by(2).lazy.grep {|n|
    RangeNum(n.ilog2, 0, -1).none {|k| n - (1<<k) -> is_prime }
})

with (50) {|n|
    say ("first #{n} de Polignac numbers:")
    polignacs.first(n).slices(10).each{|s| say("%5d"*s.len % s...) }
}

say ''; [1000, 10000].each{|n|
    say "#{n}th de Polignac number: #{polignacs.nth(n)}"
}
```

#### Output:

```
first 50 de Polignac numbers:
    1  127  149  251  331  337  373  509  599  701
  757  809  877  905  907  959  977  997 1019 1087
 1199 1207 1211 1243 1259 1271 1477 1529 1541 1549
 1589 1597 1619 1649 1657 1719 1759 1777 1783 1807
 1829 1859 1867 1927 1969 1973 1985 2171 2203 2213

1000th de Polignac number: 31941
10000th de Polignac number: 273421
```


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://trizen.gitbook.io/sidef-lang/programming_tasks/d/de_polignac_numbers.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
