Questions tagged [number-theory]

Questions on the number-theoretic functionality of Mathematica.

Filter by
Sorted by
Tagged with
5
votes
1answer
187 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
117 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
380 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
78 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
87 views

Understanding the question

Let n be the integer shown below: ...
0
votes
1answer
107 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
642 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
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 ...
8
votes
3answers
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 ...
1
vote
1answer
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 ...
3
votes
1answer
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 ...
1
vote
1answer
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: ...
0
votes
0answers
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: ...
2
votes
5answers
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 ...
1
vote
1answer
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 ...
0
votes
3answers
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 ...
0
votes
1answer
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 ...
2
votes
1answer
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}}$$ ...
1
vote
1answer
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 ...
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
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$.
0
votes
1answer
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 ...
3
votes
1answer
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 ...
3
votes
1answer
109 views

Where is the Chebyshev function of the second kind in Mathematica/Alpha?

I need to perform some computations involving the Chebyshev function of the second kind (sometimes also called the summatory Von Mangoldt function) $\psi(x)$, defined as $$\psi(x) = \sum_{n\le x} \...
-1
votes
1answer
101 views

Plotting Poset Relations in Mathematica [closed]

Let $n$ be a positive integer and let $p$ denote the largest prime $\le n$. Let $i=2^{a_2}3^{a_3}5^{a_5}\cdots p^{a_p}$, $a_l\ge 0$. For nonprimes $s,t\le n$, we say $s\le t$ (poset relation) if, for ...
1
vote
1answer
133 views

Summing over Prime Factors (without repetition)

Wolfram Mathworld (http://mathworld.wolfram.com/SumofPrimeFactors.html) describes a function sopfr(n), the sum of prime factors, which I currently need. This code doesn't work when I insert it in ...
0
votes
1answer
87 views

Hecke Operator- sum over divisors of a number

I am trying to write out the Hecke Operator; however, I don't know how to sum over all divisors of an integer. Could someone please give me some advice how to do that. Below is the Hecke Operator ...
4
votes
2answers
138 views

Sum indexed by Primes [duplicate]

How can I express a sum indexed by primes in Mathematica? Two examples that I am interested in are (1) where the primes go from $p=2$ to, say, $p=17$. (2) It would also be useful to have the sum ...
5
votes
1answer
395 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 ...
-5
votes
3answers
122 views

Finding all the perfect integers below 10000 [closed]

I have a homework problem about perfect numbers. I simply did it, but I need to use Divisors, Most, ...
6
votes
2answers
516 views

How can I solve a certain congruence equation?

I want to solve the congruence $3x^2 + 6x + 1 \equiv 0 \pmod {19}$. I know that one way to solve this is to first solve the congruence: $t^2 \equiv 5 \pmod {19}$, because $b^2 - 4ac \equiv 24 \equiv ...
1
vote
1answer
71 views

Decoding Message-Signature Pairs

I've been given a set of message-signature pairs to decrypt using a public RSA key I set up. I need to sort through the decoded messages, and find which of those have a valid signature. My public key ...
1
vote
0answers
118 views

What is the shortest way to calculate Euler's Phi function ( excluding EulerPhi )?

With the risk of closure by the duplicate zombies ( this one might do: How can I write the natural numbers less than $n$ that are coprime to $n$? ) I dare to ask the following question. My hobby ...
0
votes
1answer
68 views

Find a number's digits in an arbitrary base [closed]

I want to write a program in Mathematica which for an input $n$ gives me a representation in a number system of base 26. For example, $$1419=2\cdot 26^2+2\cdot 26+15.$$ The output I am looking for is ...
2
votes
0answers
60 views

Introducing constraints in FrobeniusSolve

I have a knapsack problem. Say I have N possible items $x_i$. I would like to know: $ \sum_{i=0}^{2} c_i x_i = W$ With the following constraint: $c_i=3 \lor 4$ As an example suppose the set $x_i=...
9
votes
1answer
161 views

Modular equation problem

I have problem solving this modular equation $67^n \equiv 67 \pmod {317026939759222841944}$ with $n>1$. I have tried my Laptop and Wolfram Alpha engine, but I don't get any solution, I'm very ...
0
votes
1answer
65 views

List of PrimeFactors without powers

If I do FactorInteger[120] I get {{2, 3}, {3, 1}, {5, 1}} which is correct of course, but how do I get it as or change it ...
4
votes
1answer
356 views

Zeckendorf representation

Zeckendorf's theorem. Every positive integer $n$ can be expressed uniquely as a sum of distinct non-consecutive Fibonacci numbers Sequence of Fibonacci numbers which add up to $n$ is called the ...
2
votes
1answer
683 views

List of Coprimes

Is there a way to generate a list of parametrized length, say $L$, of integers which are relatively prime among them? I would like to take into account their word-length as well, so for example the ...
6
votes
1answer
108 views

Efficient way to sum all divisors of numbers below N excluding divisors 4/d

So, I want to Sum all divisors off all numbers below N (for a big N, i.e. N=10^16) which (divisors) are NOT a multiple of 4 I tried DivisorSigma but then the following method was x2 faster ...
2
votes
3answers
181 views

How to find all prime power factorizations of an integer

I want to put in $n$ and get the possible factorizations into prime powers. Let's say for 24 I want {{8,3}, {4,2,3}, {2,2,2,3}}. The algorithm for doing this on ...
0
votes
0answers
42 views

Randomly selected two integers are relatively prime [duplicate]

The probability that two integers $m$ and $n$ picked at random are relatively prime is $6/\pi^2$ There is a simple code to check it ...
3
votes
1answer
81 views

Problem with QPochhammer or SeriesCofficient?

In version 10.2.0, I calculated the number of integer partitions of n into exactly k distinct parts with no part exceeding ...
9
votes
1answer
346 views

Calculate $140$ digits of Conway's Constant from the Look and Say Sequence

The look-and-say sequence is the sequence of numbers $1, 11, 21, 1211, 111221, 312211, …,$ in which each term is constructed by “reading” the previous term in the sequence. For example, the term $1$ ...
13
votes
7answers
2k views

Finding vampire numbers

How to find vampire numbers by using Mathematica? A number $v=xy$ with an even number $n$ of digits formed by multiplying a pair of $n/2$-digit numbers (where the digits are taken from the ...
5
votes
2answers
121 views

Finding all solutions in the Roth's theorem

Roth's theorem. For all algebraic irrational $\alpha$ $$\displaystyle \left \lvert \alpha - \frac{p}{q} \right \rvert < \frac{1}{q^{2 + \epsilon}}$$ with $\epsilon>0$, has finitely many ...
3
votes
0answers
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 ...
3
votes
2answers
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 ...
5
votes
1answer
353 views

Algorithm for Egyptian fractions, want to optimize the maximum denominator size

Any rational number can be expanded into a finite sum of unit fractions with distinct denominators, called Egyptian fractions. There is no 'optimal' algorithm in terms of denominator size or number ...
4
votes
3answers
181 views

find and count the number of solutions without multiplicity in Solve?

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 ...