Questions tagged [number-theory]

Questions on the number-theoretic functionality of Mathematica.

Filter by
Sorted by
Tagged with
1
vote
0answers
65 views

Last digits via PowerMod [closed]

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

SquaresR memory leak?

I have tried the following code in Mathematica 11.0.1.0 on my MacBook: ...
0
votes
0answers
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];] ...
1
vote
1answer
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 ...
4
votes
1answer
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 ...
11
votes
2answers
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. ...
0
votes
1answer
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 ...
9
votes
2answers
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,...
0
votes
1answer
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 ...
3
votes
1answer
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 ...
0
votes
1answer
268 views

Some information about PrimeQ function

In Mathematica there is a built-in function called PrimeQ which tests given input as True or ...
5
votes
1answer
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 ...
0
votes
2answers
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 ...
0
votes
0answers
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. ...
4
votes
4answers
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 ...
8
votes
2answers
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 ...
19
votes
4answers
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 ...
2
votes
1answer
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? ...
9
votes
2answers
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 ...
3
votes
0answers
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. ...
0
votes
1answer
88 views
3
votes
0answers
115 views
3
votes
1answer
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$$ ...
1
vote
1answer
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$
2
votes
0answers
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 ...
-2
votes
2answers
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.
15
votes
1answer
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 ...
2
votes
1answer
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. ...
3
votes
0answers
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?
3
votes
0answers
202 views

FrobeniusSolve: how does it work?

Can someone suggest any reference to read? I would like to understand how the algorithm works.
16
votes
1answer
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....
13
votes
1answer
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 ...
6
votes
3answers
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.}$...
3
votes
1answer
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: ...
2
votes
1answer
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 ...
3
votes
1answer
297 views

Question about this Sieve of Eratosthenes graph

I googled for images of graphs and found nothing that even comes close to this one, so I want to experiment some more. ...
3
votes
1answer
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 ...
8
votes
1answer
196 views

Using Mathematica to find an alternative continued fraction for $\zeta(5)$

Given the Riemann zeta function $\zeta(n)$. I. $x=\zeta(3)$ Using Euler's continued fraction formula, we can form $\zeta(3)$'s cfrac as, $$Ax+B = \cfrac{1}{v_1 - \cfrac{1^6}{v_2 - \cfrac{2^6}{...
12
votes
3answers
816 views

Double Sum Involving Condition

I would like to compute the dimensions of some small free nilpotent Lie algebras. However, I am totally new to this and I could not figure out how to write the double sum which gives the dimension of ...
15
votes
2answers
416 views

Factor a polynomial Root into Roots of smallest possible degree

Suppose I have a polynomial Root representing an algebraic number. I want to represent it as a product of several polynomial Root...
-5
votes
1answer
259 views

Finding a seven-digit number with all of its prime factors less than 20? [closed]

How can I find a seven-digit number with all of its prime factors less than 20? I have no clue how to do this.
3
votes
1answer
82 views

A function about prime gaps

I want to define a $f$ function on Mathematica such as this. $f[k]$ gives the smallest $m$ holds $2k=Prime[m+1]-Prime[m]$. For example, $$f[1]=2$$ $$f[2]=4$$ $$f[3]=9$$ $$f[4]=24$$ How can i do that?...
8
votes
4answers
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$, ...
2
votes
3answers
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 ...
11
votes
2answers
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 ...
6
votes
1answer
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 ...
0
votes
0answers
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 ...
1
vote
0answers
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 ...
5
votes
2answers
240 views

Finding vector of same direction with smallest integer coordinates

To determine Miller Indices of crystal lattice planes I would need a stable algorithm which determines the smallest set of integer coordinates of a vector which has same direction as a given vector (e....
0
votes
1answer
107 views

Why does this function return the largest integer less than or equal to √n?

I've been asked this question by my teacher. The function I'm talking about is the following: ...