# Prime number hunting

**URL:** <https://discourse.julialang.org/t/prime-number-hunting/106771>\
**Category:** New to Julia\
**Created:** [November 26, 2023, 10:43pm UTC](https://discourse.julialang.org/t/prime-number-hunting/106771 "2023-11-26T22:43:18Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![Loves\_Reddit](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/loves_reddit/32/204014_2.png) [@Loves\_Reddit](https://discourse.julialang.org/u/Loves_Reddit)\
**Post date:** [November 26, 2023, 10:43pm UTC](https://discourse.julialang.org/t/prime-number-hunting/106771/1 "2023-11-26T22:43:19Z")

</div>

Hello are there any Julia programs for prime number hunting similar to GIMPS?

---

<div class="post-metadata">

**Author:** ![Nathan\_Boyer](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/nathan_boyer/32/14825_2.png) [@Nathan\_Boyer](https://discourse.julialang.org/u/Nathan_Boyer)\
**Post date:** [November 27, 2023, 7:58pm UTC](https://discourse.julialang.org/t/prime-number-hunting/106771/2 "2023-11-27T19:58:53Z")

</div>

I know nothing about this field, but searching on [JuliaHub](https://juliahub.com/ui/Search?q=prime&type=packages) yielded [Primes.jl](https://github.com/JuliaMath/Primes.jl).

---

<div class="post-metadata">

**Author:** ![stevengj](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/stevengj/32/71_2.png) [@stevengj](https://discourse.julialang.org/u/stevengj)\
**Post date:** [November 27, 2023, 10:16pm UTC](https://discourse.julialang.org/t/prime-number-hunting/106771/3 "2023-11-27T22:16:38Z")

</div>

> [@Loves\_Reddit](#):
>
> Hello are there any Julia programs for prime number hunting similar to GIMPS?

I don’t know of any intensive efforts specifically on prime searching in Julia, and of course there’s not a lot of motivation to simply re-implement special-purpose algorithms that have already been intensively optimized in other languages (such as counting primes or searching for Mersenne primes).

As @Nathan_Boyer mentioned, there is a native Julia package Primes.jl that provides basic functionality in this regard, but it’s not currently designed to compete with heavily optimized libraries for well known functions like prime-counting (ala the [`primecount`](https://github.com/kimwalisch/primecount) C++ program). See also the discussions in:

- [Fast Generation of Arrays of Prime Numbers](https://discourse.julialang.org/t/fast-generation-of-arrays-of-prime-numbers/101120)
- [Number of primes below a given number - #37 by miguelraz](https://discourse.julialang.org/t/number-of-primes-below-a-given-number/58709/37)
- [Improving performance in checking prime numbers - #11 by Oscar\_Smith](https://discourse.julialang.org/t/improving-performance-in-checking-prime-numbers/56365/11)
- [How to reduce memory allocations in the Sieve of Eratosthenes?](https://discourse.julialang.org/t/how-to-reduce-memory-allocations-in-the-sieve-of-eratosthenes/70679)

However, there are reportedly people working on _new_ research problems in computational number theory using Julia, e.g. via the [Hecke.jl](https://github.com/thofma/Hecke.jl) package.
