> For the complete documentation index, see [llms.txt](https://trizen.gitbook.io/sidef-lang/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://trizen.gitbook.io/sidef-lang/programming_tasks/p/primes_n-2_m_1.md).

# Primes n\*2 m 1

Takes \~2 seconds to run.

```ruby
for n in (1..400) {
    var p = (^Inf -> lazy.map {|m| [m, n * 2**m + 1] }.first_by { .tail.is_prime })
    printf("%3s %4s: %s\n", n, p...)
}
```

(same output as the Perl version)
