Questions tagged [number-theory]

Questions on the number-theoretic functionality of Mathematica.

Filter by
Sorted by
Tagged with
2 votes
6 answers
439 views

All solutions that satisfy $ x_{1}^{5}+x_{2}^{5}+x_{3}^{5}+x_{4}^{5}-x_{5}^{5}=0 $

I want to find a combination that satisfies all the solutions of the following formula. $$ x_{1}^{5}+x_{2}^{5}+x_{3}^{5}+x_{4}^{5}-x_{5}^{5}=0 $$ $x_{1}$, $x_{2}$, $x_{3}$, $x_{4}$, and $x_{5}$ are ...
Vancheers's user avatar
  • 525
5 votes
2 answers
186 views

How to make FactorInteger iterative?

I want to factorize big numbers like 10^100. FactorInteger with no Automatic option can take a lot of time and as I know there ...
Андрей Яндуганов's user avatar
0 votes
0 answers
37 views

Manipulating Dirichlet characters and L functions

I read some basic knowledge about characters and L functions, and would like to play around with them in MMA. I tried to do the following things, but ending in minor success. (MMA notation used) ...
Po1ynomial's user avatar
3 votes
1 answer
102 views

How to make a function that returns all super distinct partitions?

I am working on distinct partitions. I recently created a function StrictIntegerPartitions. This is from the book Integer Partitions by George E. Andrews at Pennsylvania State University and Kimmo ...
Peter Burbery's user avatar
8 votes
4 answers
686 views

Design a function that gives all strict partitions of an integer

A strict partition of an integer has all distinct parts. There are no duplicates like 1 in {5,3,1,1} for 10. All the parts are unique. Sylvester created a bijection between the partitions of an ...
Peter Burbery's user avatar
3 votes
4 answers
1k views

Solve Olympiad Problem with Mma

Find all integers $k\le100$, so that there exists an integer $n$, satisfying \[k\mid3n^6+26n^4+33n^2+1.\] By number theory knowledge it suffices to check $n\in[1,k]$, but we'll do $[1,100]$ for ...
youthdoo's user avatar
  • 145
2 votes
0 answers
42 views

Using "ToNumberField" as opposed to equations over the integers

Let D>1 be a square-free rational integer, and write \Q for the rationals. I am trying to determine the (non-)membership of ...
GaryMak's user avatar
  • 121
1 vote
1 answer
94 views

Why do some functions, or at least, PowersRepresentations, run far faster on subsequent calls? What determines this behaviour?

Say I run the following: PowersRepresentations[4782969,4,2] and it takes about 2 minutes. If I call it again it takes only about 0.0005 seconds. What determines ...
1729taxi's user avatar
  • 737
0 votes
1 answer
60 views

Does applying Reduce result in an equivalence or a oneway implication or both? [closed]

If I type something like this into Mathematica: ...
Mats Granvik's user avatar
  • 1,149
1 vote
1 answer
80 views

Select primes from their Zeckendorf representation

I'm working with the Zeckendorf representation of prime numbers. I'm using ResourceFunction["ZeckendorfRepresentation"][Prime[n]] and I would like to select from all the results, the ones ...
user967210's user avatar
1 vote
1 answer
63 views

Representing a number in r0 + r1 E + r2 E^2 form

Let E be the base of natural logarithm 2.71... A Sequence S[n] is believed to converge to a ...
imida k's user avatar
  • 4,037
2 votes
3 answers
316 views

How to determine the unique combination of digits satisfying a given relation?

Is there a method to determine the unique combination of numbers a, b, c and d which satisfy the relation below, and which yields the output with the numbers in the given order. Example for 2023 is ...
thils's user avatar
  • 3,188
5 votes
2 answers
626 views

Can I use NextPrime[n] up to n=10^14?

I would like to perform computations with primes up to $n=10^{14}$. To do so, I would like to go through all primes, from $2$ to $10^{14}$ and perform some calculation on each prime. I saw that one ...
Klangen's user avatar
  • 967
3 votes
6 answers
630 views

How to ask Mathematica to compute the given sum of the differences of the numbers of the given two sets?

I have two sets of real numbers, say, set1= {b1, b2, b3, b4, b5, b6, b7, b8, b9, b10, b11} ...
MsMath's user avatar
  • 115
1 vote
1 answer
135 views

A square board of size n*n [closed]

I would like to Randomly generate n^2 natural numbers in an interval from 1 to n. Then consider placing each number on the cell with the same number (you can imagine the board numbered naturally, row ...
SkySystem's user avatar
2 votes
2 answers
178 views

Writing the number '80668227' as a sums of 4 & 5 cubes

I need to write the number '80668227' as a sum of 4 & 5 cubes. I tried this code PowersRepresentations[80668227, 4, 3] in Mathematica but the above code is ...
Littlewood's user avatar
5 votes
0 answers
60 views

Dedekind Zeta Function in Mathematica (at least for quadratic number field)

Does there exist some way to use Mathematica to compute the Dedekind Zeta function for an arbitrary algebraic number field? Or does there exist some package to do this? I am actually only interested ...
Mike Battaglia's user avatar
5 votes
4 answers
1k views

Finding least n such that n^2 + 23 is divisible by large powers of 2

Lets say that we want to find the least n such that n^2+23 is divisible by 2^100. We can compute this in one line using the Pari/GP language: ...
ZaMoC's user avatar
  • 6,587
4 votes
3 answers
286 views

Find all sets whose index is divisible by the elements

Suppose I have such a set $S=\{3,4,5,...n+2\}, n\in \mathbb{Z}_{>\, 0} $, $a_n$ is any permutation of $S$ such that $n|a_n$, I want to know how many such $a_n$. The easy but inefficient way to do ...
expression's user avatar
  • 5,562
3 votes
4 answers
98 views

How to Make a list or table containing the product of every three digit integer in mathematica

I am trying to learn the mathematica language. And it was suggested to me to start by doing the Project Euler problems. I am currently working on Problem # 4: A palindromic number reads the same both ...
SugarFoot's user avatar
4 votes
2 answers
92 views

Test if the decimal digits of $n$ appear $n$ times in the decimal representation of $n!$

I want to find numbers $n$ for which the decimal digits of $n$ appear $n$ times in the decimal representation of $n!$. For instance, $n\in\left\{0, 1, 1170, 1528, 9877, 9886, 9897, 11535\right\}$ are ...
Jan Eerland's user avatar
  • 1,941
3 votes
2 answers
169 views

System of equations

I am trying to find ALL or a list of possible values for x satisfying: x MOD 9 ==2 AND (x+631) MOD 9 = 3 Using Mathematica. can anyone help? 2 is not the only answer 497 is another one since 497 mod ...
hamzeh musmar's user avatar
6 votes
2 answers
109 views

Reduce an expression where the variables can assume only $\pm 1$

I would like to solve this equation: x1y1 + x2y2 + x3y3 + x4y4 = 0 and I would like to count the number of distict solutions. Here $x_1,\dots,x_4$ and $y_1,\dots,...
Luca Onnis's user avatar
1 vote
1 answer
96 views

Extracting powers of a sum

Given a sum in the form Sum[n^k, {k, kl}] for some natural n and natural list kl, is it ...
sam wolfe's user avatar
  • 4,187
0 votes
0 answers
63 views

Repeated DirichletConvolve of MangoldtLambda and MoebiusMu

There is a bug in DirichletConvolve. These two codes are same except that in first one MoebiusMu is used in another ...
azerbajdzan's user avatar
  • 7,094
3 votes
0 answers
140 views

DirichletTransform gives incorrect result

Bug introduced in 13.0 or earlier and persisting through 13.2.0 or later. Input 1: ...
azerbajdzan's user avatar
  • 7,094
2 votes
0 answers
81 views

Thue equations solving with Reduce

Could somebody tell me whether Reduce assumes (or not) the GRH when solving Thue equations? Given its performances (related to timing) compared to PARI/GP when the "GRH assumed" flag is set ...
Michel ROBERT's user avatar
3 votes
2 answers
225 views

Strange behavior of 'SquareFreeQ'

What is the cause of this strange behavior of SquareFreeQ while PrimePowerQ works correctly: ...
azerbajdzan's user avatar
  • 7,094
2 votes
1 answer
67 views

Choosing numbers whose divisors can be partitioned into subsets having the equal sum

How can we find the list of natural numbers between 100 to 10000, whose positive divisors can be partitioned into three subsets such that sum of all the elements in three subsets will be equal?
Anirban Roy's user avatar
5 votes
1 answer
63 views

Picking integer compositions with certain descent patterns

I am trying to find a nice way to pick out all the integer compositions (ordered partitions) of an integer $n$ that satisfy a given pattern of descents between some adjacent elements. Writing a ...
Brian Hopkins's user avatar
4 votes
1 answer
199 views

Choosing a subset of a set based on the sum of its elements

How can we choose a subset of a set based on the sum of the elements of the subset? For instance, n=6 dn=Divisors[n] sn=DivisorSum[n,#&] Is it possible to ...
Puneeth's user avatar
  • 41
5 votes
1 answer
90 views

How to prove that a list of algebraic numbers with the same symbolic expression is a number field?

Definition of number field (K): (1) $0,1 \in K$ (2) $\alpha, \beta \in K \Longrightarrow \alpha \pm \beta \ and\ \alpha \beta \in K$ (3) $\alpha, \beta \in K$, and $\beta \neq 0 \Longrightarrow \...
lotus2019's user avatar
  • 1,921
3 votes
2 answers
105 views

Check certain expression using a while loop to run through all posibilities in a range

Well, I have written the following code (using the fast square root test found in this answer): ...
Jan Eerland's user avatar
  • 1,941
7 votes
2 answers
273 views

Longest arrangement of n-digit square numbers s.t. last digit equals first digit of next

I have this problem: consider all the square numbers with exactly n digits, I want to arrange them such that the last digit of a square is equal to first digit of the next square and find the longest ...
user967210's user avatar
6 votes
3 answers
1k views

The integer ababab (a,b>0) is always divisible by 7, without remainder

The integer $ababab$ $(a>0,b>0)$ is always divisible by $7$, without rest. I tried to prove this by: ...
mrz's user avatar
  • 11.6k
2 votes
3 answers
195 views

How do I maximize the following?

I want to maximize $${T(\epsilon)=\max\left\{\log_{(1/y)}\left(|\sqrt{2}-x/y|\right):x,y\in\mathbb{N}, |\sqrt{2}-x/y|<\epsilon\right\}}$$ Edit: I changed the inequality, it was supposed to be ...
Arbuja's user avatar
  • 29
0 votes
1 answer
105 views

Divisibility problem! I cannot find a proof. Help would be appreciated! [closed]

It appears that IntegerQ[(2 k - 2^k)/(2 k + 1)] and IntegerQ[(2^k + 1)/(2 k + 1)] have the same k values. Proof?
Hilko Koning's user avatar
3 votes
1 answer
144 views

Faster PowersRepresentation using IntegerPartitions

Earlier I posted a question about taking fast integer square roots of known integer perfect squares. The reason this came up is I was trying to find a faster way of mimicking the PowersRepresentations[...
1729taxi's user avatar
  • 737
3 votes
1 answer
140 views

Mathematica code for q-Stirling numbers

In the paper [A new $q$-Analog of Stirling Numbers],(https://hal.archives-ouvertes.fr/hal-01372920/document)[PDF] J. Cigler defined $q$-Stirling numbers of the second kind as the following: He ...
d.y's user avatar
  • 143
0 votes
1 answer
60 views

Check if a fraction leads to an integer, choose $r$ and run trough $0\le a\le n$ and go to $r+1$

Well, I am trying to do the following: I have two functions $y(r,a)$ and $z(r,a)$ and I want to check of the division of both those functions leads to an integer. In order to do that I want to choose ...
Jan Eerland's user avatar
  • 1,941
2 votes
2 answers
116 views

Finding IntegerPartitions[252] with no zero and no duplicates

Well, I am trying to execute the following code: ...
Jan Eerland's user avatar
  • 1,941
0 votes
0 answers
49 views

Alternative for PowerRepresentations[n, x, 1]

I am looking for numbers $n$ that can be written as the sum of other numbers. So: PowersRepresentations[n, x, 1]. But is there a faster way of finding these numbers?...
Jan Eerland's user avatar
  • 1,941
0 votes
0 answers
67 views

Fourier expansion of Dedekind eta function with rational arguments

I want to be able to compute the Fourier series expansion in q=Exp[2πiz] for DedekindEta[(az+b)/(cz+d)] with integer a,b,c,d, but not requiring ad-bc=1. Just replacing z in terms of q and doing ...
Ying's user avatar
  • 101
4 votes
3 answers
327 views

Checking if a number is right sorted

I have a number $n$ such that the digits of $n$ are strictly increasing to the left except for the first digit. So for example when $n=51369$ fits the bill because: $$1<3<6<9\tag1$$ Is there ...
Jan Eerland's user avatar
  • 1,941
2 votes
1 answer
168 views

Calculate the Leyland number index of a given Leyland (x,y) pair

A Leyland number L(x,y) is x^y + y^x where x>=y>1. OEIS A076980 prepends L(2,1) as its first term. The first ten Leyland number (x,y) pairs ordered by magnitude are (2,1), (2,2), (3,2), (4,2), (...
Hans Havermann's user avatar
5 votes
1 answer
400 views

Sum a number's digits until only one digit remain

I want to iteratively calculate the sum of a number's digits, until the result contains only one digit. For example, when $n=67946$ we get: $$6+7+9+4+6=32\space\to\space3+2=5\tag1$$ So, when $n=67946$ ...
Jan Eerland's user avatar
  • 1,941
2 votes
0 answers
112 views

Finding the sum of the product of factorials of the digits of numbers

I want to calculate the sum of the product of factorials of the digits of numbers. So for example, when $n=467$ I get: $$n=467\space\to\space\left(4!\right)\cdot\left(6!\right)\cdot\left(7!\right)=...
Jan Eerland's user avatar
  • 1,941
5 votes
8 answers
1k views

Making the number 12345...n

Well, I am trying to write a code that makes the number: $$123456\dots n\tag1$$ So, when $n=10$ we get: $$12345678910$$ And when $n=15$ we get: $$123456789101112131415$$ And when $n=4$ we get: $$1234$$...
Jan Eerland's user avatar
  • 1,941
0 votes
1 answer
85 views

Parallelization in While[] loop when testing if a condition is met

Well, I am trying to run the following code: ...
Jan Eerland's user avatar
  • 1,941
1 vote
0 answers
100 views

Implementing the Binary GCD algorithm in Mathematica

Well, I have $n\in\mathbb{N}$ and I want to transform $n$ to a binary number which can be done using FromDigits[IntegerDigits[n, 2]]. I want to compute the ...
Jan Eerland's user avatar
  • 1,941

1
2 3 4 5
9