# Questions tagged [number-theory]

Questions on the number-theoretic functionality of Mathematica.

286 questions
Filter by
Sorted by
Tagged with
187 views

549 views

### InverseTotient[ ]?

Maple has a function InverseTotient( c ), which returns all those natural numbers $n$ whose Euler totient function $\phi( n ) = c$. Is there an equivalent inverse ...
311 views

### How to represent integers using Egyptian fractions?

Let $N(n)$ be a set of integers, which can be presented using first $n$ Egyptian fractions: $$N(n):=\{m\in\mathbb{Z}:\ \ m=\sum_{i=1}^n\frac{\epsilon_i}{i},\ \epsilon_i=0\ \text{or}\ 1\}$$ I want ...
91 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 ...
184 views

### Generation of Step Numbers

I am working on Project Euler 178 but got stuck in trying to optimize my code. The following text comes from the problem: Consider the number $45656$. It can be seen that each pair of ...
123 views

### Calculate 40 digits of the MRB constant

MRB constant is the upper limit point of the following sequence $$s_n=\sum_{k=1}^{n} (-1)^k k^{\frac{1}{k}}$$ $MRB=\color{blue}{0.1878596}...$ I tried to calculate first few digits: ...
51 views

### Question about how to use NestWhileList

I start with: n = 2228; m = n/2; PreviousPrime[n_] := NextPrime[n, -1] I use NestList to build the following list: ...
138 views

### How can I find the $c$ such $Max[Fibonacci[Range[c]]] = 13$?

How can I find the $c$ such Max[Fibonacci[Range[c]]] = 13 I tried Reduce but there is an error message ...
134 views

### Number of primes between two integers x and y (with x < y and excluding x and y)

There is a formula given at the bottom of the following webpage: https://math.stackexchange.com/questions/288747/how-to-find-number-of-prime-numbers-between-two-integers to calculate the number of ...
128 views

### Listing products of prime powers

Given a positive integer $n$, what is the code to list $2^{a_2}3^{a_3}\cdots p^{a_p}$, where $a_i\ge 0$ are integers, with respect to the lexicographic ordering on $(a_2,a_3,\ldots, a_p)$? The only ...
305 views

### GCD using Euclidean Algorithm

My assignment is to calculate the GCD of two numbers n and m using the Euclidean Algorithm which basically states that if the remainder = 0 the GCD is the 2nd of the two numbers. SO my thought was to ...
225 views

### Finding all integer solutions of the following inequality $\bigg| \sqrt[3]{2}-\frac{p}{q} \bigg | <\frac{1}{q^{5/2}}$

I want to find integer solutions of the following inequality by using Mathematica $$\bigg| \sqrt[3]{2}-\frac{p}{q} \bigg | <\frac{1}{q^{5/2}}$$ ...
63 views

### Converting sequece of code into a function [closed]

I constructed a pretty basic sieve of Eratosthenes and would like to use it as a function rather than copy pasting output, how do I achieve ...
51 views

### Code needed to determine the smallest k that the equation will fail by brute force [closed]

I find one of the suggested solution to this problem a little bit questionable: “If N is divisible by 1, 2, 3,. . . M, then N must also be divisible by M + 1, M + 2, M + 3, . . . M + k for k is a ...
311 views

### Solving a diophantine equation with three variables

Solve this equation using Mathematica: $2^x + 113^y = z^2$, $\operatorname{gcd}(x, y) = 1$.
67 views

### Having a Problem with Manipulate

I'm trying to work out a new way of visualizing the Collatz conjecture (or 3n+1 problem) using the Manipulate feature of Mathematica to show paths that numbers take in the 3n+1 problem in the form of ...
104 views

### Having problems with Manipulate

I'm trying to create a diagram that could be used to visualize the Collatz Conjecture in a new way, but I can't get Manipulate to work in the way I want it to. The goal of the program is to have m ...
109 views

98 views

### Wrong divergence message for the continued fraction

Bug introduced in 8.0.4 or earlier and fixed in 11.2 Why there is an error message for ContinuedFractionK[k, 1, {k, Infinity}]? It is well known that, this ...
360 views

### Expressing numbers as the sum of 2^(2^k) powers

I have a list of numbers and I want to express each one as an integer linear combination of $2^{(2^k)}$ powers. Some elements of the list are ...
I would like to solve a Diophantine equation and find its solution, but I need only count one time for each $a$, i.e., when for some $a$ it found some $x,y,z$, then go to the next $a$. more precisely ...