Standard library / math/big

big.Jacobi()

Computes Jacobi symbol of x over odd integer y; even y panics. Returns -1, 0 or 1. Expected stdout: '1\n'.

Formal Syntax & Structure

go syntaxgo
func Jacobi(x, y *Int) int

Parameters & Attributes

NameTypeDescription
x*IntFirst input operand (or sole input if unary).
y*IntSecond input operand.

Return Value

int

Computes Jacobi symbol of x over odd integer y; even y panics. Returns -1, 0 or 1.

Working Example

Example Snippetgo
package main
import (  "fmt"  "math/big")
func main() {  fmt.Println(big.Jacobi(big.NewInt(2), big.NewInt(7)))}
Go Reference