Questions tagged [modular-arithmetic]

92 questions
22
votes
2 answers

What is the difference between modulo and modulus?

Throughout my education in computer science, I feel like I've heard the terms "modulo" and "modulus" used interchangeably. It looks like even Wikipedia claims that "modulo" is "sometimes called 'modulus'" (see the first sentence of the page on…
intcreator
  • 367
  • 1
  • 3
  • 15
11
votes
2 answers

modular multiplication

I was reading the Modular Multiplication page on wikipedia...and could not understand the algorithm to compute $a \cdot b \pmod{m}$. uint64_t mul_mod(uint64_t a, uint64_t b, uint64_t m) { long double x; uint64_t c; int64_t r; if (a >= m) a…
user -1
  • 111
  • 1
  • 5
5
votes
1 answer

Computing MOD_4 function using MOD_2, OR, AND, NOT gates

Define the $\newcommand{\MOD}{\text{MOD}}\MOD_q$ function from $\{0,1\}^n \rightarrow \{0,1\}$ as follows: Let $x_1,\cdots,x_n$ be the input. Then $\MOD_q(x_1,\cdots,x_n)=0$ if the number of 1's in $x_1,\dots,x_n$ is divisible by $q$;…
Pranav Bisht
  • 255
  • 2
  • 7
5
votes
1 answer

Fixed base exponentiation with precomputations

I'm trying to compute $g^m$ mod $n$ where $m,n$ are 1024-bit numbers. The method I want to use is fixed base exponentiation with precomputations, also known as fixed-base windowing.The paper I'm following is Brickell et. al. "Fast Exponentiation…
nullgraph
  • 194
  • 1
  • 7
5
votes
0 answers

Is there a sub-quadratic algorithm to evaluate $\Pi_i\Pi_j\Pi_k\Pi_l(1+a_ib_jc_kd_l)$

I'd like to efficiently evaluate $\Pi_i^N\Pi_j^N\Pi_k^N\Pi_l^N(1 + a_ib_jc_kd_l)$ without enumerating the $N^4$ terms by brute force. I was able to achieve a mildly-efficient $O(N^2log^2(N^2))$ solution using univariate multipoint polynomial…
5
votes
0 answers

Complexity of recognizing a covering system

Suppose we a given a set $S$ of residues $a_i\pmod{m_i}$, $i=1,2,\dots,k$. I wonder how hard it is to recognize whether they form a covering system, that is, whether for every integer $n$ there exists (at least one) $i$ such that $n\equiv…
4
votes
0 answers

Optimal parallel-time repeated modular squaring circuit

Given a 4096-bit integer $x$ and a 4096-bit RSA modulus $N$ (of unknown factorisation) what is the fastest circuit to compute $x^{2^T} \mod N$ where $T=2^{40}$. That is, what is the fastest parallel-time (i.e. lowest latency) algorithm for…
4
votes
2 answers

Curious about an old algorithm which calculates modular inverse

I am not sure if I should ask this question here or somewhere else. In fact, I initially asked my question here at mathoverflow.net but it was marked as off-topic Background: I was searching through random mathematics paper that are related to…
4
votes
2 answers

Calculating modulus of large non-factored numbers

The internet is full of algorithms to calculate the modulo operation of large numbers that have the form $a^e \bmod p$. How about numbers with unknown factorization. More precisely, let's say I have a 4-byte sized modulus prime $p$, and a large…
caesar
  • 153
  • 3
4
votes
1 answer

Computing modular exponent given order

I want to compute $g^{mn}$ mod $n^2$ where $n=pq$ and I know that $g$ has order $kn$ mod $n^2$ where $m
nullgraph
  • 194
  • 1
  • 7
4
votes
3 answers

How can I compute an exponential modulo a large integer?

Does anyone have the computational power to check whether or not $F(m)^d \equiv m \pmod n$, where the values of the variables are found below. According to Wolfram Alpha, I found the result of the computation $F(m) \equiv m^e \pmod n$, however I…
4
votes
1 answer

Name of graph family defined by modular sum

In the context of finite, simple, undirected graphs, associate with each node $v\in V$ an integer $n(v)$ (you can limit this to positive integers without loss of generality). Create the set of edges by defining a threshold $T$, and join an edge…
JimN
  • 891
  • 7
  • 22
3
votes
1 answer

Smallest multiple of a number that gives a specific remainder modulo another number

Given three positive integers $a, b$ and $c$, my task to find the smallest positive integer $k$ such that $(k * a) \mod b = c$. I can obviously try values of $k$ from $1$ and higher, until I find the right value. My question is, can this computation…
3
votes
1 answer

3-SAT and Systems of Nonlinear Modular Equations

How is the 3-SAT problem reduced to solving for a system of nonlinear modular equations? I have read https://stackoverflow.com/questions/4294270/how-to-prove-that-a-problem-is-np-complete in how to prove that a problem is NP complete?. But how is…
Jeff
  • 113
  • 1
  • 9
3
votes
2 answers

Floating-point modular multiplication algorithm

Is there a well-known algorithm for modular multiplication of floating-point numbers? I would like to multiply some large angle in single precision (6-7 significant digits) and wrap it back to 360 degrees, without losing too many significant…
phil5
  • 33
  • 4
1
2 3 4 5 6 7