# Questions tagged [modular-arithmetic]

The tag has no usage guidance.

64 questions
Filter by
Sorted by
Tagged with
31 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 ...
74 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 ...
68 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 ...
57 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 ...
311 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: ...
498 views

557 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 ...
623 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: ...
65 views

### Last digits via PowerMod [closed]

Do you have an idea why this produces different results? PowerMod[2003, 2002^2001, 1000] 241 ...
190 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 ...
143 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}} ...
67 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: <...
154 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"...
246 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 ...