optimus_prime 0.0.4+4 copy "optimus_prime: ^0.0.4+4" to clipboard
optimus_prime: ^0.0.4+4 copied to clipboard

A library to aid working with prime numbers.

optimus_prime #

A library to aid working with prime numbers.

Hecho en 🇵🇷 por Radamés J. Valentín Reyes

Import the Library #

import 'package:optimus_prime/optimus_prime.dart';

Library Examples: #

Extension Methods #

Check if an integer is prime:

2.isPrime();

Check if an integer is coprime with another

22.coprimeWith(21);

Find the factors of an integer

int testInt = 10;
List<int> factors = testInt.factors();
print("Factors of  $testInt");
print(factors);

Optimus Prime class methods #

Get the first prime integer found after the specified number

OptimusPrime.primeAfter(28);

Get the first prime integer found before the specified number

OptimusPrime.primeBefore(3);

Get a list of prime integers within the specified range

List<int> primeList = OptimusPrime.primesInRange(from: 1,to: 1000);
1
likes
130
points
0
downloads

Publisher

unverified uploader

Weekly Downloads

A library to aid working with prime numbers.

Documentation

API reference

License

MIT (license)

More

Packages that depend on optimus_prime