> 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/s/sum_of_primes_in_odd_positions_is_prime.md).

# Sum of primes in odd positions is prime

```ruby
var sum = 0
1e3.primes.each_kv {|k,v|
    if (k+1 -> is_odd) {
        sum += v
        say "#{k+1} #{v} #{sum}" if sum.is_prime
    }
}
```

#### Output:

```
1 2 2
3 5 7
11 31 89
27 103 659
35 149 1181
67 331 5021
91 467 9923
95 499 10909
99 523 11941
119 653 17959
143 823 26879
```
