Questions tagged [modular-arithmetic]

The tag has no usage guidance.

65 questions
Filter by
Sorted by
Tagged with
58 views

How to Plot modulo function Mod on a function of two variables? [closed]

I know that Plot[Mod[x, 2], {x, -6, 6}] is a Mathematica command to plot the remainder of x over 2 when I range x over reals -6 to 6. How do I plot the same ...
35 views

FindEquationalProof to prove divisor theorem

I'm trying to implement proofs of concepts for Equational Proofs on some basic number theory theorems. One such example is: "let a and b be positive integers and let d = gcd (a, b). If t divides ...
84 views

Polynomial PowerMod

Is there equivalent of PowerMod for polynomials in Mathematica? We have Mod[a^e,m]==PowerMod[a,e,m], $a$, $e$ and $m$ all ...
78 views

List of invertible congruence classes

I am attempting to create a list of the invertible congruence classes $\bmod 120$. The code I have is ...
58 views

Is this decryption function idiomatic?

This is my first non-trivial Mathematica notebook, which I wrote for a cryptology homework. It encrypts/decrypts strings using an affine cipher. Is the code readable/idiomatic? How could it be ...
1k views

Fast calculation of discrete logarithms

Does Mathematica have any built-in fast algorithms for calculating discrete logarithms over $(\mathbb{Z}_p)^\times$ (the group of integers modulo $p$)? Essentially, for a fixed large prime ...
320 views

How to reverse in modular arithmetic

Given an RGB color {127, 255, 212} where scale is 0-255, VBA's RGB function find a long integer x such that ...
41 views

Looping on ranges (Modular iterations)

Is it possible to make the following code modular, so that it works up till depth n, and returns an array of all possible combinations for used{}? ...
237 views

Solving for $d$ in $x= E^d \bmod(n)$

With regards to Public Key Cryptography, I have been tasked with the problem of attacking some information given in an assignment and discovered a private key used to digitally sign a message. Known: ...
584 views

580 views

MatrixPower with Modulus

I have a matrix that will be multiplied with itself by an extremely large amount of times under $Z/pZ$. The matrix itself contains small numbers, so ...
626 views

Incrementing a number where each digit has a different base

Let's say I have a list, for instance {10,5,3}, indicating the bases for each digit of my 3-digit number. Using this basis, if I wanted to increment {8,4,1} a couple of times, here's what I would get: ...
66 views

Last digits via PowerMod [closed]

Do you have an idea why this produces different results? PowerMod[2003, 2002^2001, 1000] 241 ...
192 views

Memory problem when solving a system of modular equations [duplicate]

I need to solve the following system of modular equations, but the computation can't finish because I run out of memory (I have 12 GB of RAM). Is there any workaround to this problem? I am using ...
144 views

Bug in PiecewiseExpand and Mod with assumptions

Bug introduced in 9.0 or earlier and fixed in 10.4 The following code using PiecewiseExpandand Modgives the wrong answer <...
53 views

Function to add two matrices mod 2 [duplicate]

I have: lightstep[m_, gg_] := Which[gg == {1, 1}, m = Mod[m + m, 2]] Then I entered: A = {{1, 1, 0}, {1, 0, 0}, {0, 0, 0}} ...
73 views

Finite fields package doesn't simplify

I'm trying to do arithmetic using the FiniteFields package. Supposing a is a generator of a Galois field (say GF(2^5)) I want to be able to simplify things like a^32 and (a^8)^-1. I don't care about ...
72 views

Want code for a modular operation

Given numbers a1 and a2 and a positive integer k, such that ...
58 views

Putting some calculations together to form an algorithm

Considering these below where n is an odd number, k is also an odd number less than n: <...
157 views

Coppersmith method of small integer solutions to multivariate polynomials

In http://link.springer.com/chapter/10.1007%2F3-540-68339-9_14#page-7 is presented a method for finding small solutions to multivariate polynomials. (Although here he mentions that it "is not rigorous"...
253 views

Evaluate modular fractions

If I have a list of numbers l = {256/11, 258/11, 263/11, 263/11, -22, -22, 251/11, 0, 261/11, -22, 265/11, 259/11, 0, 259/11} which I want to evaluate mod 26, how ...
146 views

Sparse matrix multiplication mod p

Let A and B be sparse matrices with integer coefficients between 0 and ...
1k views

527 views

Reduce Vector/Matrix mod N [closed]

If I have a vector such as below and want to reduce it mod a number, how can I do this? V = {{176}, {648}}; MatrixForm[V] MatrixForm[V, Modulus -> 26] Both ...
i'm pretty noob with mathematica but i need to solve an equation: $$c\equiv m^2\pmod n$$ I tried something like ...