Skip to content
This repository has been archived by the owner on Jul 27, 2023. It is now read-only.
/ numbers Public archive

GO package numbers implements useful functions to work with prime numbers, Fibonacci, and parity.

License

Notifications You must be signed in to change notification settings

alesr/numbers

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

33 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

numbers Build Status

GO package numbers implements useful functions to work with prime numbers, Fibonacci, and parity.

PACKAGE DOCUMENTATION

package numbers

import "github.com/alesr/numbers"

Package numbers implements useful functions to work with prime numbers,
Fibonacci, and parity.

FUNCTIONS

func EvenNumbers(a, b int) ([]int, error)
    EvenNumbers returns a list of even numbers from A to B.

func FactorsList(n int) ([]int, error)
    FactorsList lists all prime factors for a positive integer position.
    Does not include repeated factors.

func FibonacciGen() chan int
    FibonacciGen emits an infinite stream of Fibonacci values.

func IsPrime(n int) bool
    IsPrime checks if a given positive int is a prime number.

func NthEven(pos int) (int, error)
    NthEven returns the nth even number for a given position.

func NthFibonacci(pos int) int
    NthFibonacci returns the nth Fibonacci value for given a int position.

func NthOdd(pos int) (int, error)
    NthOdd returns the nth odd number for a given position.

func OddNumbers(a, b int) ([]int, error)
    OddNumbers returns a list of even numbers from A to B.

func SliceByParity(a, b int) (even, odd []int, err error)
    SliceByParity iterates over each n from A to B and add n to a slice of
    odd or even numbers.

About

GO package numbers implements useful functions to work with prime numbers, Fibonacci, and parity.

Topics

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages