<commit_before># PrimalEx

NIF Elixir bindings for the [Primal](https://github.com/huonw/primal) Rust library.

It utilizes the [Rustler](https://github.com/hansihe/rustler) library to handle the NIF interop, which may or may not be production-ready. Be aware of the caveats outlined in [this blog post.](http://hansihe.com/2017/02/05/rustler-safe-erlang-elixir-nifs-in-rust.html)

## Installation
The package can be installed
by adding `prime_ex` to your list of dependencies in `mix.exs`:

```elixir
def deps do
  [{:primal_ex, "~> 0.1.4"}]
end
```

You may have to install Rust as well. Official installation instructions are [here](https://www.rust-lang.org/en-US/install.html)

## Usage examples

```elixir

# Get a list of primes less than 40
PrimalEx.primes(40)
{:ok, [2, 3, 5, 7, 11, 13, 17, 19, 23, 29, 31, 37]}

# Get a list of the primes between 100 and 120
>>>  primes(100, 120)
[101, 103, 107, 109, 113]

# Get a list of the first 10 primes
PrimalEx.n_primes(10)
{:ok, [2, 3, 5, 7, 11, 13, 17, 19, 23, 29]}

# Get a list of the first 10 primes >= 1000
>>>  n_primes(10, 1000)
[1009, 1013, 1019, 1021, 1031, 1033, 1039, 1049, 1051, 1061]

# Get the 10th prime
>>> nth_prime(10)
29

# Count the primes below 10**9
>>> count_primes(10**9)
50847534


```
<commit_msg>Fix return type on README<commit_after># PrimalEx

NIF Elixir bindings for the [Primal](https://github.com/huonw/primal) Rust library.

It utilizes the [Rustler](https://github.com/hansihe/rustler) library to handle the NIF interop, which may or may not be production-ready. Be aware of the caveats outlined in [this blog post.](http://hansihe.com/2017/02/05/rustler-safe-erlang-elixir-nifs-in-rust.html)

## Installation
The package can be installed
by adding `prime_ex` to your list of dependencies in `mix.exs`:

```elixir
def deps do
  [{:primal_ex, "~> 0.1.4"}]
end
```

You may have to install Rust as well. Official installation instructions are [here](https://www.rust-lang.org/en-US/install.html)

## Usage examples

```elixir

# Get a list of primes less than 40
PrimalEx.primes(40)
{:ok, [2, 3, 5, 7, 11, 13, 17, 19, 23, 29, 31, 37]}

# Get a list of the primes between 100 and 120
>>>  primes(100, 120)
{:ok, [101, 103, 107, 109, 113]}

# Get a list of the first 10 primes
PrimalEx.n_primes(10)
{:ok, [2, 3, 5, 7, 11, 13, 17, 19, 23, 29]}

# Get a list of the first 10 primes >= 1000
>>>  n_primes(10, 1000)
{:ok, [1009, 1013, 1019, 1021, 1031, 1033, 1039, 1049, 1051, 1061]}

# Get the 10th prime
>>> nth_prime(10)
{:ok, 29}

# Count the primes below 10**9
>>> count_primes(10**9)
{:ok, 50847534}


```

{'fraction_non_alphanumeric': 0.14969135802469136, 'fraction_numerical': 0.11882716049382716, 'mean_word_length': 4.155069582504971, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 31, 'https://': 6, 'lorem ipsum': 0, 'www.': 2, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 4, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '5334178', 'n_tokens_mistral': 1278, 'n_tokens_neox': 995, 'n_words': 346}