# Questions tagged [number-theory]

Questions on the number-theoretic functionality of Mathematica.

286 questions
Filter by
Sorted by
Tagged with
65 views

### Last digits via PowerMod [closed]

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

### SquaresR memory leak?

I have tried the following code in Mathematica 11.0.1.0 on my MacBook: ...
24 views

### How to solve equations in Gaussian integers modulo p efficiently [duplicate]

This question is related to my previous question which can be found here. Calling the function sols1 = gaussianPowerModList[I, 8192, 18446744069414584321];] ...
249 views

### How to solve equations in Gaussian integers modulo p

How to solve a complex equation of the form: $$z^n \equiv i \pmod p$$ where $z$ is a Gaussian integer, $i$ is the imaginary number, $n, p \in \mathbb{Z}^+$ and $p$ is prime. I am dealing with quite ...
133 views

### Sum of squared digits returns incorrect result

For the sake of practicing writing code, I've given myself an exercise in writing a script that checks whether a given positive integer is happy, i.e. take the digits of a number, square them, and add ...
1k views

### Finding Ramanujan's taxicab numbers

How to find Hardy-Ramanujan Numbers by using Mathematica? Definition: Taxicab number is defined as the smallest number that can be expressed as a sum of two positive cubes in $n$ distinct ways. ...
87 views

### How to solve this problem in Mathematica?

Let's say we have some 4-character strings: fxhg eagc aceh chbe beca From those strings we want to get the correct passcode. Each of the string contains two ...
600 views

### Visualizing the primes with the Riemann Zeta function

I am trying to plot the identity seen here, namely that if we define: $$\psi _{0}(x)={\frac 12}\left(\sum _{{n\leq x}}\Lambda (n)+\sum _{{n<x}}\Lambda (n)\right)$$ Then, it equal to the following,...
135 views

### How to plot the number of Mersenne Primes lower than a given input?

I would like to plot the number of Mersenne primes (primes of the form $2^n-1$) lower than a given input. I am totally noob to mathematica and I do not know where to start from. I have tried to ...
565 views

### How does Mathematica compute how to write integers as the sum of k non-negative pth integer powers so quickly?

"PowersRepresentations[n,k,p] gives the distinct representations of the integer n as a sum of ...
268 views

### Some information about PrimeQ function

In Mathematica there is a built-in function called PrimeQ which tests given input as True or ...
43 views

### Speak stops on first Hyphen with IntegerName

IntegerName returns the text of an integer. However, when Speak is applied to the result it stops at the fist hyphen. For ...
171 views

### Powers of prime factors of a positive integer $n$ in “Mathematica”?

I would like to find the powers of a prime in the unique prime factorization of an $n$. I want a function $f[n,p]$ such that $n,p$ are given and I need to know what the power of $p$ is. For instance ...
58 views

### MultiplicativeOrder understanding

According to specification, this should find the smallest integer $m$ such that $10^m \, mod \, 16 = 0$, or return unevaluated if there is no such integer. ...
193 views

### Trying to find the numbers which could be shown in 3 different ways using Legendre's three-square theorem

Legendre's three-square theorem states that $n=a^{2}+b^{2}+c^{2}$ if and only if $n$ is not of the form $n = 4^a(8b + 7)$ for integers $a$ and $b$. There are numbers like 54 which can be ...
925 views

### Plotting the sum of two points on an elliptic curve

I am doing an experiment to prove the associativity of the addition of points on an elliptic curve. So far, I have produced a code which allows me to move points on my curve. To find their sum, I ...
3k views

### Find the 5566th digit after the decimal point of 7/101

I want to find the 5566th digit after the decimal point of 7/101. I input the following code into Mathematica 11: Mod[IntegerPart[7/101*10^5566], 10] The output ...
88 views

### What is the correct and conventional way to express the Dirichlet eta function as Dirichlet characters in Mathematica?

What is the correct and conventional way to express the Dirichlet eta function as Dirichlet characters in Mathematica? ...
199 views

### Efficiently checking whether a number is a perfect power

Goal The goal is to efficiently check whether a number is a perfect power. Attempts It is possible to check whether a number is a perfect power using ...
133 views

### Rationalize error

The docs state that "Rationalize[x,dx] yields the rational number with smallest denominator that lies within dx of x." However, testing this out it appears to be false. ...
88 views

...
115 views

...
92 views

### Numerical testing of Hardy's inequality

I want to check the following, Hardy's most fundamental inequality, by using Mathematica: $$\sum_{n=1}^\infty \left(\frac{A_n}{n}\right)^p<\left(\frac{p}{p-1}\right)^p\sum_{n=1}^\infty a_n^p$$ ...
214 views

### Get Mathematica to solve Modular Arithmetic problem [closed]

How would I get Mathematica to solve something like this for $x$? $4x \equiv 1 \pmod 5$
131 views

### Check Zagier theorem about Mahler's measure

I want to check the following theorem by using Mathematica: (from Heights of Polynomials and Entropy in Algebraic Dynamics, page 22) $\textbf{Theorem}.$ Let $\omega$ denote a primitive $6th$ root ...
282 views

### How can I implement Jordan's totient function?

How can I implement Jordan's totient function? It is a generalization of Euler's Phi function.
970 views

### Visualisation of the field of algebraic numbers in the complex plane

Hot to plot the field of algebraic numbers in the complex plane? In this picture, the color of a point indicates the degree of the polynomial of which it’s a root: red = rational numbers ...
307 views

### Efficiently create a list of factors of consecutive integers

I'm interested in a scalable (read: sublinear) algorithm for producing the list of integer factors of each integer from 1 to n. ...
78 views

### Are there any Mathematica programs on or about the LMFDB Archive?

I would like to explore the LMFDB Archive with L-functions using Mathematica. Is there any Mathematica sample code available to get me started?
202 views

### FrobeniusSolve: how does it work?

Can someone suggest any reference to read? I would like to understand how the algorithm works.
205 views

### Is it better to completely forget about the existence of PowersRepresentations?

I noticed that in several cases the performance of PowersRepresentations is hugely worse than that of IntegerPartitions. (Mma 10....
284 views

### Accuracy of PrimeQ function

Using PrimeQ in Mathematica 10 on integers up to $2\cdot 10^{5717}$ the function appears to work. The Documentation for Mathematica 5 says that ...
310 views

### Find the number of $n$ such that $n!$ is a sum of three squares

I want to check the following theorem by using Mathematica: $\textbf{Theorem}$. $\text{The estimate}$ $\# \{n \le x:n! \text{ is a sum of three squares}\}=7x/8+O(x^{2/3})$ $\text{holds.}$...
89 views

### FindInstance only satisfies half of my double inequality

FindInstance[ 298973528525.436 < 10^10*(n - k*3.32192809488736) < 298973528539.862, {n, k}, Integers ] Result is: ...
135 views

### Twin Prime Max Gaps (Performance Tuning)

Ok, let's build a foundation here: A common way of testing primality, is dividing by all primes smaller than the number's square root. For instance, $97$ is prime because dividing by none of the ...
297 views

I googled for images of graphs and found nothing that even comes close to this one, so I want to experiment some more. ...
39 views

### What is the form of a PrimalityProving`PrimeQCertificate?

I understand the format of a proof of compositeness of an integer produced by PrimeQCertificate: it's well-documented that ...
196 views

719 views

### Goldbach Partition

I want to check the Goldbach conjecture for a big number of $n$, but I don't know how to define this in Mathematica. These are my questions: Find a pair of primes $(p,q)$ for every even integer $n$, ...
324 views

### Truncate an infinite continued fraction at order 2000

I want to solve an equation which contains an infinite continued fraction $F(n)$. Then I must (obviously) truncate this continued fraction at $n=2000$. The problem here is that Mathematica does not ...
1k views

### Number of digits for factorial of 12345678987654321

What is the number of digits (IntegerLength) of the factorial of 12 345 678 987 654 321? The number of zeros at the end of this factorial was calculated and it is huge: exactly 3 086 419 746 913 569 ...
145 views

### Faster square test for integers

This question was asked already in Jan '12 and the most recent answer is from Oct '12, so it's several Mathematica versions out of date. What is a faster test for whether an integer is a perfect ...
68 views

### LatticeReduce question

Does LatticeReduce work with arbitrary precision arithmetic? That is, if I give it a linearly independent integer basis, but the integers are 40 decimal digits long ...
83 views

### Coppersmith's algorithm like Pari's zncoppersmith?

Is there some Mathematica package (or built-in that I missed) available, more or less equivalent to Pari's zncoppersmith function? Paraphrasing that source: given ...