math

package
v0.0.0-...-7a52e3f Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jul 18, 2025 License: MIT Imports: 3 Imported by: 0

Documentation

Overview

Package math Copyright 2023 Oleg Fomenko. All rights reserved. Use of this source code is governed by a BSD-style license that can be found in the LICENSE file.

Package math Copyright 2023 Oleg Fomenko. All rights reserved. Use of this source code is governed by a BSD-style license that can be found in the LICENSE file.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func FindSquareRoot

func FindSquareRoot(n *big.Int, p *big.Int) (*big.Int, error)

FindSquareRoot uses Cipolla algorithm to solve x^2 = a (mod P) More information: https://en.wikipedia.org/wiki/Cipolla%27s_algorithm

func GCD

func GCD(a, b *big.Int) *big.Int

func GenRandPrime

func GenRandPrime(size int) (*big.Int, error)

func Jacobi

func Jacobi(a *big.Int, p *big.Int) (r *big.Int, err error)

Jacobi method calculates Jacobi symbol. About: https://en.wikipedia.org/wiki/Jacobi_symbol Definition: Jacobi(a, p) = Legendre(a,p1)*Legendre(a,p2)...*Legendre(a,pn)

func LCM

func LCM(x ...*big.Int) *big.Int

func Legendre

func Legendre(a, p *big.Int) (*big.Int, error)

func Mu

func Mu(n *big.Int) int

func Phi

func Phi(n *big.Int) *big.Int

func TestPrime

func TestPrime(n *big.Int) (bool, error)

TestPrime implements the Solovay–Strassen test for prime numbers More info: https://en.wikipedia.org/wiki/Solovay%E2%80%93Strassen_primality_test

Types

type F2

type F2 struct {
	// contains filtered or unexported fields
}

F2 represents field extension for F(sqrt(i)): {x + y*sqrt(i) | x, y from F_modulo}

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL