Top "Number-theory" questions

Number theory is that branch of mathematics that investigates the properties of numbers, typically whole numbers.

How does this prime number test in Java work?

The code snippet below checks whether a given number is a prime number. Can someone explain to me why this …

java primes number-theory
What's a nice method to factor gaussian integers?

I already have prime factorization (for integers), but now I want to implement it for gaussian integers but how should …

algorithm math complex-numbers prime-factoring number-theory
finding a^b^c^... mod m

I would like to calculate: abcd... mod m Do you know any efficient way since this number is too big …

algorithm math number-theory
Given a string of a million numbers, return all repeating 3 digit numbers

I had an interview with a hedge fund company in New York a few months ago and unfortunately, I did …

python algorithm data-structures number-theory
Greatest GCD between some numbers

We've got some nonnegative numbers. We want to find the pair with maximum gcd. actually this maximum is more important …

algorithm math algebra number-theory
Easiest way to perform modular matrix inversion with Python?

I'd like to take the modular inverse of a matrix like [[1,2],[3,4]] mod 7 in Python. I've looked at numpy (which does …

python matrix number-theory matrix-inverse
What is the fastest way to check if two given numbers are coprime?

One way is to calculate their gcd and check if it is 1. Is there some faster way?

algorithm number-theory greatest-common-divisor
Algorithm for finding smallest number with given number of factors

What's the most efficient algorithm anyone can think of that, given a natural number n, returns the least natural number …

algorithm numbers number-theory
Find sum of factors

Why does this code return the sum of factors of a number? In several Project Euler problems, you are asked …

math sum number-theory factors
Calculating sum of geometric series (mod m)

I have a series S = i^(m) + i^(2m) + ............... + i^(km) (mod m) 0 <= i < m, k may be …

number-theory