Socket
Book a DemoInstallSign in
Socket

github.com/mathyourlife/lt3maths

Package Overview
Dependencies
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

github.com/mathyourlife/lt3maths

Source
Go
Version
v0.0.0-20150517211038-0ff0919cd397
Version published
Created
Source

lt3maths

I <3 maths

Some golang packages to aid in maths exploration.

prime - Prime Number Generator

package main
import(
  "fmt"
  "github.com/mathyourlife/lt3maths/prime"
)
func main () {
  // Initialize the generator
  p := prime.NewPrimeGenerator()
  // Generate 10 primes
  for j := 0; j < 10; j++ {
    fmt.Println(p.Next())
  }
  // Show the current list of primes
  fmt.Println(p.Primes)
}

primefactorization - Calculate the Prime Factorization

package main
import (
  "fmt"
  "github.com/mathyourlife/lt3maths/primefactorization"
)
func main() {
  pf := primefactorization.NewPrimeFactorization()
  result := pf.Of(12)
  fmt.Println(result)
  // map[2:2 3:1]
}

lexperm - Lexicographic Permutation Generator

package main
import(
  "fmt"
  "github.com/mathyourlife/lt3maths/lexperm"
)
func main () {
  lp := lexperm.LexPerm{}
  a := []int{0, 1, 2}
  for {
    fmt.Println(a)
    more := lp.Next(a)
    if !more {
      break
    }
  }
}

FAQs

Package last updated on 17 May 2015

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts