Stack Exchange Network

Stack Exchange network consists of 174 Q&A communities including Stack Overflow, the largest, most trusted online community for developers to learn, share their knowledge, and build their careers.

Visit Stack Exchange

Questions tagged [number-theory]

Questions on the number-theoretic functionality of Mathematica.

-3
votes
0answers
50 views

How to design and deal with repeating decimals? [on hold]

Repeating decimals could be represented by fractions. Given $ \huge{\frac{1}{3}=0.33333\overset{!}{3}}\tag{1} $ if multiply $3$ on both sides,is this step wrong?...
4
votes
1answer
52 views

Computing the seven roots of a polynomial

This question was originally asked by @fsrong70 six months ago. The OP deleted it shortly after posting and has not returned to this site since. I had just figured it out when it was deleted. I ...
4
votes
0answers
72 views

Not comprehending PowerMod

Bug introduced in 10.3 or earlier and persisting through 11.3.0 or later The bug is not present in 10.0. By definition, PowerMod[a, 1/r, m] finds a modular rth root of a mod m. Here's a pair of ...
0
votes
0answers
81 views

On the distribution of PIPs and Ramanuajn primes in Ulam's spiral

The Ulam's spiral represents the prime numbers by spiral. The code provided by Wolfram Mathematica is easy and given by ...
3
votes
2answers
784 views

Determining if a number is divisible by 1000 [closed]

I have a number such as: a = 875952; And I want to find if it is divisible by 1000. Is there a concise way of doing that?
4
votes
3answers
339 views

Generate numbers relatively prime with a given number

I am interested in a function such that f[m, i] = n where m, n are positive integers and n ...
0
votes
0answers
69 views

Find the maximum of a function involved with Floor function

My function is $$ f(H,p) = \left\lfloor \dfrac{\lfloor H/p\rfloor + 3 - \sqrt{(\lfloor H/p\rfloor + 1)^2 - 4H}}{2} \right\rfloor $$ The constraints are $ H \geq p(4p-1) $, $ p $ is prime although ...
0
votes
1answer
63 views

What is the best build-in function to pick or select given element in a huge list

im looking for a best and efficient function works like a search engine it takes for example m=5+6I ,then it goes searching in the list V={1,1+I,2+3I,...} until catch it . My Dr said to use "Select[]"...
7
votes
2answers
274 views

Efficient code for minimum integer with given number of factors

I'm seeking an efficient implementation of the number-theoretic function giving the smallest integer $n$ that has exactly $k$ factors (not necessarily prime): ...
6
votes
2answers
143 views

Finding $x$, the exponent of a $2^x$ when we need an specific output

Say we need a program Findx[n_Integer, m_Integer] where n is an integer from 1 to 9 and m is an integer from 1 to 1000. The output of the program is a number x, which is the exponent of 2 that ...
-5
votes
1answer
136 views

Solving Diophantine equations 5 [closed]

Given a positive integers x,y,m would like to be able to find integer solutions z from Diophantine equation x^2-y^2 = m*z in Z. ---The proof,is divided in 4 sections---... x=2*k+1 ,y=2*h+1 with ...
1
vote
0answers
43 views

Problem in Counting the Number of Divisors with a Function [closed]

I want to create a function in mathematica which returns the number of divisors of a parameter x. So, I created the following function: d[x_] = Length[Divisors[x]]; And when I evaluate: d[1] d[2] ...
1
vote
1answer
23 views

Finding smallest domain within which variables can satisfy inequality

Given an arbitrary number of variables $\epsilon_i$ that can be picked from a domain $[0, W]$ and some inequality relation between all the variables $G(\epsilon_1, \epsilon_2, ...)$, is there some way ...
8
votes
5answers
339 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?
3
votes
0answers
91 views

How to find, load and use a legacy Mathematica package

Question: How to find, load and use a legacy Mathematica package from a previous Mathematica version? What is the preferred approach and process? Context: I am working through a set of examples in ...
1
vote
1answer
39 views

FunctionDomain in the Reals numbers [closed]

Why don't I obtain that $x$ belongs to the Reals? ...
-2
votes
2answers
81 views

Simultaneous equation [closed]

How to solve Simultaneous equation in Mathematica: x^2 - (a^2 - 1)y^2 = 1 and y^2 - pz^2 = 1 where ...
1
vote
1answer
82 views

Number-theoretic function using Table

I'm trying to make a function to calculate the Log sum of primes over a limited range $1/2n$ to $n$ or Chebychev theta function over limited range $1/2n$ to $n$. This will be used only for even ...
7
votes
4answers
281 views

Find the order $m$ of a matrix ${\bf A}$ such that ${\bf A}^m= {\bf 1}$

I have a square matrix ${\bf A}$ defined over the field $\mathbb Z_2$ and I want to find its order such that ${\bf A}^m=1$. I tried using ...
2
votes
1answer
41 views

How to define a function the Dirichlet L-function $L(s,\overline{\chi(5,2)})$ in Mathematica?

In Mathematica: The Dirichlet L-function with character $\chi(5,2)$, $L(s,\chi(5,2))$, is expressed as DirichletL[5,2,s] Let $\overline{\chi(5,2)}$ be the complex ...
11
votes
3answers
1k views

François Viète's approximation to π

How do I program the approximation to π devised by François Viète, which is given by 2 * 2/Sqrt[2] * 2/Sqrt[2 + Sqrt[2]] * 2/Sqrt[2 + Sqrt[2 + Sqrt[2]]] * ... ...
0
votes
0answers
41 views
0
votes
2answers
90 views

Code for finding $a$ and $b$ such that $a b = 1 \mod 4$ [closed]

I need to find $a$ and $b$ such that $a b = 1 \mod 4$? I do not know how to write the code. Could someone help me?
3
votes
1answer
72 views

Generating numbers palindromic in two number bases

The purpose of the code below is to generate numbers that are $2d+1$ digit palindromes in number base $b+1$, and are also palindromic in number base $b+3$, where: The ...
0
votes
1answer
162 views

Easy number theory problem

$p$ is an odd prime number,$S = \{x \mid 1 \leq x \leq 2p, x \in \mathbb{Z} \}$, $A$ is a subset of $S$, satisfying $\operatorname{card}(A) = p$ $\sum\limits_{x\in A} x \equiv 0 \pmod p$...
0
votes
2answers
121 views

Iterative calculation of a number-theoretical constant [closed]

Recently the decimal expansion of a number theoretic constant was searched for, which is the analog of the Landau-Ramanujan constant in a certain context. The constant starts 0.638909... It can be ...
6
votes
1answer
95 views

Finding minimum x such that Mod[3^x, m] == 1 for m not multiple of 3 [closed]

I would like to find smallest x value for each m value such that Mod[3^x, m] == 1, where m is not multiple of 3. Here is my ...
2
votes
0answers
60 views

Listing divisors of a number [closed]

I created a list with all divisors of 18000: list1 = Divisors[18000] I did an analysis to identify which of these numbers are divisible by $15$, but the result I ...
5
votes
5answers
204 views

Question about how to speed up Mathematica code

When looking at the Minimal Goldbach prime partition point {p,q} for each n; where n=10^i and i = 2,3,4,...,10; I notice that these points reside in an interval with center n/2 and radius 250: ...
4
votes
1answer
164 views

solid partitions generator

According to Wikipedia, a solid partition of $n$ is a three-dimensional array $n_{i,j,k}$ of non-negative integers (with indices $i,j,k \geq 1$) such that $$\sum_{i,j,k} n_{i,j,k}=n$$ and $$n_{i+1,j,k}...
3
votes
1answer
110 views

How can I define $i^2=j^2=k^2=-1$ in Mathematica?

First, I want to define the identities as $i^2=j^2=k^2=-1$, $ij=k=-ji$, $jk=i=-kj$, $ki=j=-ik$. And then I want to use these identities in my sequence $Q_n = F_n + iF_{n+1} + j F_{n+2} + k F_{...
9
votes
4answers
338 views

First two n such that $1355297$ divides$10^{6n+5}-54n-46$ for $n>0$

I have problem solving this equation, smallest n such that $1355297$ divides $10^{6n+5}-54n-46$. I tried everything using my scientific calculator, but I never got the correct results(!).and finally I ...
0
votes
1answer
49 views

function that generates a list of all plane partitions of a given dimension

Is there a function in Mathematica that generates a list of all plane partitions of a certain dimension $n$? This paper describes the algorithm, but I still find it a bit tricky to do it myself.
0
votes
1answer
86 views

Understanding the question

Let n be the integer shown below: ...
0
votes
1answer
97 views

Generate a prime number satisfying a condition

Building on the same context of this question Is it possible to enforce constraints on the properties of the generated prime? For example, I'm trying to find a prime $p$ in the range specified in the ...
3
votes
3answers
633 views

Solving a system of diophantine equations from a mathematical competition

There is a problem from the $66th$ Putnam Mathematical Competition, $B2$ Find all positive integers $n,k_1,k_2,...,k_n$ such that $$k_1+\cdots+k_n=5n-4$$ and $$\frac{1}{k_1}+\cdots+\frac{1}{...
15
votes
1answer
545 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 ...
8
votes
3answers
295 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 ...
1
vote
1answer
74 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 ...
3
votes
1answer
135 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 ...
1
vote
1answer
114 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: ...
0
votes
0answers
49 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: ...
2
votes
5answers
129 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 ...
1
vote
1answer
112 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 ...
0
votes
3answers
99 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 ...
0
votes
1answer
238 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 ...
2
votes
1answer
148 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}}$$ ...
1
vote
1answer
60 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 ...
1
vote
1answer
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 ...
-3
votes
2answers
278 views

Solving a diophantine equation with three variables

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