Coder Social home page Coder Social logo

elm-arithmetic's Introduction

Arithmetic: Elm library for integer arithmetic and number theory

(View the docs here.)

Implements some useful functions involving:

  • Parity and modular arithmetic
  • Base conversion
  • Squares and cubes
  • Divisors, GCD, LCM
  • The Chinese Remainder Theorem
  • Prime sieves and prime checking (Miller–Rabin)

Released under the BSD3 license.

elm-arithmetic's People

Contributors

joshuahall avatar lynn avatar mbylstra avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar

elm-arithmetic's Issues

Consider longer function names for certain functions

First up - this package looks really useful! I've used Native to change number bases in the past - a pure Elm function is much better.

Is there a reason cbrt and gcd aren't named cubeRoot and greatestCommonDivisor? Seems out of place with the other functions that are in plain English. Perhaps these names are common in MATLAB or numpy, but full English is far more approachable for math noobs like myself.

Possible support for numbers larger than 32 bits?

Only because Project Euler #3 asks for the largest prime factor of 600851475143 (≈6e11) I realized that Arithmetic.primeFactors does something unexpected when faced with numbers too large to fit in 32 bits:

-- Arithmetic.primeFactors 600851475143
[71,-127237759]

It seems to handle inputs less than or equal to 2^32-1 fine but stumbles on bigger values.

Thank you for this very handy library!

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.