# Questions tagged [number-theory]

Questions on the number-theoretic functionality of Mathematica.

67 questions
Filter by
Sorted by
Tagged with
5k views

### What is so special about Prime?

When we try to evaluate Prime on big numbers (e.g. 10^13) we encounter the following issue: ...
1k views

### Double series over primes

I'm very curious if the following double series over primes has a closed form: $$\sum_{k \in \mathcal{P}}\sum_{n \in \mathcal{P}}\frac{1}{k\;n(k+n)^2}$$ where $\mathcal{P}$ denotes the set of all ...
4k views

### Fastest square number test

What is the fastest possible square number test in Mathematica, both for machine size and big integers? I presume starting in version 8 the fastest will be a dedicated C LibraryLink function.
1k views

### Why does Mathematica claim there is no even prime?

I wonder if this is a bug, or if I'm misunderstanding something: Exists[n, EvenQ[n] && PrimeQ[n]] // Resolve (* ==> False *) So if I interpret this ...
7k views

### How to find lattice points on a line segment?

How do I find points on the line segment joining {-4, 11} and {16, -1} whose coordinates are positive integers?
9k views

### Trying to visualize the Collatz conjecture

I happen to have this collatz collatz[x_, y_] := If[x == 3*y || x == 2*y + 1 || y == 3*x || y == 2*x + 2, 2, 0] So i want a visual 3D adjacency graph of my ...
525 views

### Multiplicative partition function

I am trying to create a multiplicative partition function that would generate something like ...
1k views

### Evaluate continued fraction

Mathematica has the ContinuedFraction[] function to give the continued fraction expansion of a rational (or approximation of a real) number. I'm interested in the ...
4k views

### Finding long strings of identical digits in transcendental numbers

Introduction Describing the three main streams of present-day mathematical philosophy (formalism, Platonism and intuitionism) in a well-known book, The Emperor's New Mind, R. Penrose says: ...it ...
588 views

### Speeding up the built-in Rudin-Shapiro and Thue-Morse sequence functions

Version 10.2 introduced two well-studied sequences as functions: the (Golay-)Rudin-Shapiro sequence (RudinShapiro[]) and the (Prouhet-)Thue-Morse sequence (...
270 views

### Why do these two different zetas produce the same value? [closed]

Zeta[-13] == Zeta[-1] == -1/12 Why do these two different zetas produce the same value?
501 views

### Generating a list of all factorizations

What is the best way to generate a list of all factorizations of some number $n$? I'm quite new to Mathematica so this might be obvious. I have been trying some basic stuff with ...
746 views

### Generating pairs of additive and multiplicative factors for integers

Given an integer $n$, I want to get two lists: a) the set of pairs of the divsors $a,b$ into exactly two factors $n=a\cdot b$, b) the set of pairs $a,b$ of two summands $n=a+b$. The code I ...
1k 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 ...
796 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$, ...
851 views

Is there a function similar to PrimePi that gives approximate value for large numbers? In particular, I need a reasonably good approximation for $\pi(x)$, where $x\... 5answers 2k views ### Factorisation diagrams Here is a way to visualize the factorisation of natural numbers. How do we get this or a similar kind of output using Mathematica? See the list of images generated for number from 1 to 36: 2answers 593 views ### Why does iterating Prime in reverse order require much more time? Say I would like to display the$10$greatest primes that are less than$10^5$. I could do the following: ... 2answers 536 views ### Number of divisors visualized with the QPochhammer function, how to improve performance of code? I have this code that is originally Jeffrey Stopple's code for the Riemann zeta function in the complex plane. Because I discovered yesterday that the number of divisors can be generated with the$q$-... 7answers 3k views ### Efficient way to count the number of zeros at the (right) end of a very large number If I want to count the number of zeros at the (right) end of a large number, like$12345!$, I can use something like: Length[Last[Split[IntegerDigits[12345!]]]] ... 2answers 838 views ### FiniteFields package is very slow. Any fast substitute for Mathematica? I want to compute the inverse of matrix, say with dimensions$100 \times 100$, defined over a large finite field extension such as$GF(2^{120})$. I am using the package FiniteFields, but Mathematica's ... 3answers 315 views ### Code for (a,b) with gcd(a,b)=1? I am trying to make a big table that includes all ordered pairs (a,b) with a (1,2) (1,3) (2,3) (1,4) (3,4) (1,5) (2,5) (3,5) (4,5) (1,6) (5,6) ... Any ideas? Thanks! 4answers 446 views ### How can I write the natural numbers less than$n$that are coprime to$n$? [duplicate] How can I write the natural numbers less than$n$that are coprime to$n$? 4answers 416 views ### Generate PrimePower counting function Is there a way to generate a counting function for prime powers - i.e. to create a similar function to PrimePi, but including prime powers. The following will, of ... 5answers 1k views ### Perfect numbers The question given to me: a. Find the perfect numbers between$1$and$10^6$b: Find the abundant numbers between$1$and$1000$For a, I wrote ... 1answer 479 views ### Solving a Diophantine equation with a large solution I am trying to solve the following Diophantine equation with Mathematica:$\frac{x}{y+z}+\frac{z}{x+y}+\frac{y}{x+z}=4$It is known that there are three positive numbers that satisfy the equation ... 0answers 374 views ### Parallel PowerMod Is there anyway to parallelize the PowerMod function? Here is my Left-To-Right modular exponentation: ... 3answers 223 views ### Number theory: Problem involving rational numbers Use RandomRat to test whether ((-1)^(1/Denominator[q]))^Numerator[q] is identical with (-1)^q... 1answer 274 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 ... 2answers 212 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 ... 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 ... 1answer 1k 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 ... 3answers 3k views ### Has Mathematica a function to compute the Smith Normal Form? The Smith normal form is a matrix that can be calculated for any matrix (not necessarily square) with integer entries. See Wikipedia for a more elaborate description. Has Mathematica a function to ... 3answers 188 views ### Calculating the integral points of an elliptic curve I asked this question on Math stachexchange. The question I have is: Can I use Mathematica to find the (integral points on the following elliptic curve) or can I find when the number$\text{n}$is a ... 1answer 1k views ### Von Mangoldt function Can anybody evaluate the following sum for me $$\sum\limits_{n=2}^\infty(-1)^n\left(\frac{\psi(n)}{n}-\frac{\Lambda(n)}{2n}\right)$$ where$\psi(n)$is the Chebyshev function and$\Lambda(n)$is ... 2answers 127 views ### Using the solve function for big numbers, getting a failure now When I try to solve: Solve[y^2==441+48*x*(1+x)(-13+16*x)&&1100*10^9<=y<=1200*10^9&&x>=2,{y,x},Integers] My code runs for 169 seconds and ... 1answer 584 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 ... 1answer 463 views ### SquaresR memory leak? I have tried the following code in Mathematica 11.0.1.0 on my MacBook: ... 5answers 523 views ### Does Mathematica have a twin prime equivalent of PrimePi? Well, it's all there in the title! I'd like to be able to plot the number of twin primes =<x. Is there an inbuilt function that can do this? 2answers 1k views ### Recursive Euclidean algorithm in Mathematica Can anyone explain to me how do I use a recursion, if I don't know the limit? For example, I need the remainder$r$of the Euclidean algorithm for$\gcd(a,b)$which equals$0$. I figured out that the ... 3answers 254 views ### What is the formula for this numerical series? I'm developing a questions game. My goal is that the score for each correct answer will increase as the user answers more questions. Initially there are 15 points for each correct answer. Every 4 ... 2answers 199 views ### solve for two variables for each n related to Collatz conjecture For this code, for each x I would like to solve for all value ranges for c1 and c2 in a bounded range ie c1 and c2 in the range of real numbers +-100 for c1 and c2 for each x, which combined give "... 1answer 1k views ### Factoring large integers with the Pollard p-1 method I am trying to use the Pollard$p-1$method to find the factors of a large integer. Here is the problem: An RSA-type cipher is based on the integer$n = 140016480344628383$and exponent$2345671$.... 5answers 949 views ### Write any positive integer as a sum of squares With n = 17 I would like to get {4, 1} and with n = 999 {31, 6, 1, 1} so that, for example, ... 1answer 139 views ### Complex LogIntegral error Going through Derbyshire's Prime Obsession & trying to take LogIntegral of 20^ZetaZero & comes up with a value of <... 1answer 231 views ### How to calculate the residue of$1/f(z)$at a numerical approximation to a root of$f(z)\$?

The input Residue[1/DirichletL[19,10,s],{s,s0}] gives 0 even when s0 is a root. For ...
377 views

### Conveying density of 5-smooth (Hamming) numbers

A number is 5-smooth if its only prime factors are 2, 3 or 5. Example: 1, 2, 3, 4, 5, 6, 8, 9, 10, 12, 15, … Interesting thing is that as they become larger and ...
1k views

### Triangular numbers boolean function

I read the new book by Paul Wellin Programming in Mathematica. There is an exercise about triangular numbers. (The n-th triangular number is defined as the sum of ...