Questions tagged [modular-arithmetic]

The tag has no usage guidance.

Filter by
Sorted by
Tagged with
-1 votes
1 answer
84 views

Adding Points on an Elliptic Curve

How do I do this in Mathematica? The curve given by the equation $y^2 = x^3 + 29x + 7$ defined over the integers modulo $10007$ Adding the first pair of points $P = (3737, 4549)$ and $Q = (8286, 6097)$...
Bob's user avatar
  • 1
1 vote
0 answers
51 views

How to solve quartic equation modulo a composite? [closed]

I have an univariate polynomial equation over a composite moduli. Namely the composite is of for $q=(2p)^{2}-1$ where $p$ is odd and $2p-1$ and $2p+1$ are distinct primes. The modular equation is $$ax^...
Turbo's user avatar
  • 145
0 votes
0 answers
59 views

Weird behavior of repeated Mod of Hash

I was working on a wolfram challenge problem involving Hash, and I noticed some very odd behavior. The problem is to create a function ...
ydd's user avatar
  • 3,548
4 votes
1 answer
105 views

Simplify expressions with modulo 2 (Boolean algebra)

Suppose I have a (Boolean algebra) expression a = p1 x^2 + p2 x (x-1) + 3 p3 + 4 p4 x where p1, ..., ...
Zhengyuan Yue's user avatar
4 votes
1 answer
169 views

How do I multiply two matrices mod2?

I have two matrices $A$ and $B$ which I multiply to give $$\begin{bmatrix} 2 \\ 2 \\ 2 \end{bmatrix}$$ How do I multiply these matrices Modulo 2? I would like to end up with an all zero column vector.
QC123_367's user avatar
  • 491
1 vote
3 answers
129 views

Solutions of a modular equation

I have a modular equation like this: ...
Giovanni Russo's user avatar
2 votes
0 answers
27 views

Effective way of iterating multiplication modulo p

I am trying to compute discrete logarithms modulo p (in a naive way). I have three approaches ...
gerald's user avatar
  • 233
0 votes
0 answers
28 views

Polynomial GCD over a ring with composite modulus [duplicate]

I need the gcd of two polynomials, ...
PorkyPhoenix091's user avatar
3 votes
2 answers
173 views

System of equations

I am trying to find ALL or a list of possible values for x satisfying: x MOD 9 ==2 AND (x+631) MOD 9 = 3 Using Mathematica. can anyone help? 2 is not the only answer 497 is another one since 497 mod ...
hamzeh musmar's user avatar
4 votes
1 answer
184 views

Data visualization in Mathematica (1000 x 1000 square)

I'm currently interested in looking at all the 6-digit numbers in base 10 (i.e. 000000 to 99999), and checking if they satisfy at least one of 5 equations: either 0=0+0+0+0+0, 0+0=0+0+0+0,..., 0+0+0+0+...
Haines's user avatar
  • 41
1 vote
1 answer
76 views

Simplify of `Mod` in compound logical expression

It's great that Simplify[Mod[x,2π]==0,Assumptions->{0<=x<2π}] yields x==0. However even a slightly more complicated ...
Adam's user avatar
  • 3,907
0 votes
0 answers
72 views

Fourier expansion of Dedekind eta function with rational arguments

I want to be able to compute the Fourier series expansion in q=Exp[2πiz] for DedekindEta[(az+b)/(cz+d)] with integer a,b,c,d, but not requiring ad-bc=1. Just replacing z in terms of q and doing ...
Ying's user avatar
  • 101
0 votes
1 answer
99 views

ListPlot vs. ListLinePlot How Do You Remove Discontinuous Artefacts from Introduced by Mod?

I have some data that inherently describes a phase and would like to plot it in between [0, 2*pi). When I use ListPlot with the ...
Cameron F.'s user avatar
1 vote
2 answers
469 views

Solve System of congruences

How can I solve a system of linear congruences as such? $$\begin{align*} 3x+2y+28z &= 9 \pmod {29} \\ 5x+27y+z &= 9 \pmod {29} \\ 2x+y+z &= 6 \pmod {29} \end{align*}$$ I tried it this ...
Steve237's user avatar
  • 389
2 votes
1 answer
48 views

What is the meaning of this Modulus output?

Quick question, what is the meaning of the $\mathbb{c}_1$ subscript in the output of Modulus (shown as an image below)? I understand there are two solutions to this linear congruence, 6 and 15 (6+9), ...
Jason1923's user avatar
0 votes
1 answer
107 views

Eliminate an expression with Mod operation

The target below should equal 0, since 2x + c = a + b + c = 6c, and Mod[6c,3] == 0 But ...
worldterminator's user avatar
0 votes
1 answer
69 views

Find a solution to a congruence within a specified range

My problem is to find all the integer solutions of the following conguence: $$P=0\ \text{mod}\ 4$$ where $$p=q^2∗r^2∗y^4∗z^2∗(2∗w^4+2∗r^2∗w^4∗y^4∗z^2+r^2∗w^8∗y^4∗z^2+2) + q^2+ 2∗r^6∗w^4∗y^m∗z^6∗(w+w^2+...
Safwane's user avatar
  • 121
0 votes
0 answers
169 views

Command to find the pre-image of a set that is mapped to by the function $f(x)=3^x \mod{17}$

$$f(x)=3^x \mod{17}$$ How to find the pre-image of the set if this function maps from real numbers to real numbers. What command would I use, to see the pre-image if the function would map from ...
VLC's user avatar
  • 241
3 votes
1 answer
309 views

Plot solution to damped driven pendulum in $(-\pi,\pi)$

I'm solving the damped driven pendulum: ...
corey979's user avatar
  • 23.8k
0 votes
1 answer
84 views

Modulus option quietly nerfed for Solve?

Recently asked my students to put together something like this: Reduce[x^2 ==b, b, Modulus -> 11] For me, on 12.1, this gives: ...
Kellen Myers's user avatar
  • 2,681
0 votes
0 answers
81 views

PowerMod solve for b (exponent)

Using PowerMod[a, b, m] = x I get ...
Birk Lundgren's user avatar
3 votes
2 answers
466 views

How to ask Mathematica to solve a simple modular equation

What's the most straightforward way to ask Mathematica to find all solutions of an equation like $$3x + 2y + 4z = 0 \pmod {11}$$ (for instance), where either $x$, $y$, $z$ can be considered to be ...
Daniel Asimov's user avatar
3 votes
1 answer
75 views

Can Mathematica automatically optimize an expression with PowerMod?

PowerMod[x,p,m] is significantly faster than Mod[x^p, m] for a large p I have an expression, ...
Borislav Stanimirov's user avatar
1 vote
1 answer
78 views

A modular version of LinearRecurrence?

I'm playing around with implementing the Lucas probable prime test (mainly so I can understand it better), and would love a version of the LinearRecurrence function that used addition modulo n (with n ...
Phil Ramsden's user avatar
0 votes
1 answer
48 views

Find relationship between values within finate range of integer domain

Update: There are some misakes in the coefficient of left and right. But still get similar result. I understand the mathematica ...
worldterminator's user avatar
2 votes
1 answer
81 views

How to simplify quotient and mod in integer domain

I want to simplify (a*32 + a%32)/32, and a is integer. So I write: ...
worldterminator's user avatar
3 votes
1 answer
216 views

Non-valid modulus when using LinearSolve

I have a system of linear equations I want to solve mod 4, and I happen to know the solution, but I get an error when trying to solve it using LinearSolve. I define the matrix ...
LightsOutTorus's user avatar
11 votes
3 answers
2k views

How can I program the last digits of Fibonacci numbers?

Is there a way to compute the last digits of an arbitrarily large Fibonacci number? For the $10^n$th Fibonacci number, we can just find the $2^n$-th Fibonacci number (if that isn't too large) $\bmod n$...
Allam A.'s user avatar
  • 333
2 votes
1 answer
80 views

How to get the modulus of two functions [closed]

I might be overlooking something, because what I want to do is quite elementary. I want the following term Mod[2(1 + z), (1 + z)] to evaluate to ...
hal's user avatar
  • 783
1 vote
0 answers
63 views

How to apply PolynomialMod to a SparseArray?

I have a list bdrs of SparseArrays, whose entries are polynomials in the variable t with ...
Leo's user avatar
  • 1,155
2 votes
0 answers
54 views

Why gives Modulo of complex numbers different answers for rationals and reals

When running Table[1.*Mod[(1 + I)^(1 + k*I), 1 + k*I], {k, 49, 50, 0.5}] Table[1.*Mod[(1 + I)^(1 + k*I), 1 + k*I], {k, 49, 50, 1/2}] I get for the first table <...
user57467's user avatar
  • 2,324
4 votes
3 answers
120 views

how can I calculate $a_{n+3}=a_n+a_{n+1}+a_{n+2}$?

recently I need to calculate this: $a(n+1)=((a(n-2)+a(n-1)+a(n)) \bmod 10000)$ and get $a(20000000)$ (for example). I know RecurrenceTable,but ...
AsukaMinato's user avatar
  • 8,940
0 votes
0 answers
67 views

Finding a solution to a modular problem efficiently

I want to find a naïve hash function of the form Mod[a x + b, 2^p] which would produce a value less or equal to v for all ...
kirma's user avatar
  • 18.7k
5 votes
1 answer
816 views

modulo with n instead of 0 without using if-statement

Is there a way to to express the following without using an if statement, but with mathematical operations instead? { 5 if x % 5 = 0, x % 5 otherwise }
maddingl's user avatar
  • 153
2 votes
1 answer
677 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 ...
user166305's user avatar
6 votes
1 answer
157 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 ...
Ten-Thousand-Hands's user avatar
1 vote
1 answer
385 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 ...
azerbajdzan's user avatar
  • 9,933
3 votes
1 answer
257 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 ...
ngc1300's user avatar
  • 171
1 vote
1 answer
78 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 ...
Elliot Gorokhovsky's user avatar
4 votes
3 answers
390 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 ...
user13892's user avatar
  • 9,113
0 votes
1 answer
50 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{}? ...
Ashwin Kumar's user avatar
2 votes
1 answer
255 views

How to solve a system with GCD?

For example, Solve[{x + y == 150, GCD[x, y] == 30}, {x, y}, Integers] Solve::nsmet: This system cannot be solved with the methods available to Solve. The same ...
user64494's user avatar
  • 24.5k
6 votes
1 answer
791 views

RowReduce modulo 3

When I wanted to compute a row echelon form of a matrix over the finite field ${\Bbb F}_9$ with 9 elements (which is the three element field ${\Bbb F}_3$ adjoined a square root of $-1$ which I denote ...
Markus Schweighofer's user avatar
0 votes
0 answers
174 views

Variables defined modulo $\pi$ and avoiding singularities; phase plotting for a map

I have the following $2$-dimensional implicitly defined map ...
Alex's user avatar
  • 211
1 vote
1 answer
144 views

Solving a modular equation with a large modulus [duplicate]

I am having trouble solving this equation: $17^n\equiv 1 \mod 640826899755722841329632946651705039010285107743541637238400825304943424424715705661705191669759$ for the smallest integer $n > 0$ I ...
Joo Neruhu's user avatar
0 votes
1 answer
58 views

Get missing cyclic numbers via modulus?

Consider a list of numbers: list = {1,2,3,4,5}; Taking a random set of three of these numbers: ...
Kagaratsch's user avatar
  • 11.9k
7 votes
2 answers
2k views

How can I solve a certain congruence equation?

I want to solve the congruence $3x^2 + 6x + 1 \equiv 0 \pmod {19}$. I know that one way to solve this is to first solve the congruence: $t^2 \equiv 5 \pmod {19}$, because $b^2 - 4ac \equiv 24 \equiv ...
bar's user avatar
  • 71
4 votes
1 answer
358 views

Matrix operations "Modulus->non-prime" problem

I am using Mathematica 10.4.1.0. When I specify the "Modulus" option to be a non-prime, the functions RowReduce and MatrixRank return the error ...
zornslemmings's user avatar
2 votes
1 answer
211 views

How to remove symmetries from this list?

First of all, I work with modular arithmetics and the elements of the arithmetics are lists themselves. I recognize two kinds of symmetries - shift and mirroring. We could define shift of a list like ...
Džuris's user avatar
  • 325
9 votes
1 answer
229 views

Modular equation problem

I have problem solving this modular equation $67^n \equiv 67 \pmod {317026939759222841944}$ with $n>1$. I have tried my Laptop and Wolfram Alpha engine, but I don't get any solution, I'm very ...
Anton GT's user avatar