Questions tagged [number-theory]

Questions on the number-theoretic functionality of Mathematica.

Filter by
Sorted by
Tagged with
3 votes
2 answers
140 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 ...
user avatar
6 votes
2 answers
105 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,...
user avatar
1 vote
1 answer
66 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 ...
user avatar
  • 4,368
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 ...
user avatar
  • 2,852
0 votes
0 answers
23 views

Nested DirichletConvolve

How to write a function that produces Dirichlet convolution of k number of arithmetic functions? Dirichlet Convolution has this property for arithmetic functions <...
user avatar
  • 2,852
3 votes
0 answers
114 views

DirichletTransform gives incorrect result

Input 1: DirichletConvolve[MoebiusMu[m], MangoldtLambda[m]/m, m, n]; DirichletTransform[%, n, s] (* -(Zeta'[1+s]/(Zeta[s] Zeta[1+s])) *) Input 2: ...
user avatar
  • 2,852
1 vote
0 answers
66 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 ...
user avatar
3 votes
2 answers
221 views

Strange behavior of 'SquareFreeQ'

What is the cause of this strange behavior of SquareFreeQ while PrimePowerQ works correctly: ...
user avatar
  • 2,852
2 votes
1 answer
49 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?
user avatar
5 votes
1 answer
57 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 ...
user avatar
4 votes
1 answer
148 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 ...
user avatar
  • 41
5 votes
1 answer
82 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 \...
user avatar
  • 1,407
1 vote
1 answer
47 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): ...
user avatar
  • 1,723
7 votes
2 answers
256 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 ...
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: ...
user avatar
  • 11.3k
2 votes
3 answers
185 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 ...
user avatar
  • 199
0 votes
1 answer
94 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?
user avatar
1 vote
1 answer
92 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[...
user avatar
  • 525
2 votes
1 answer
87 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 ...
user avatar
  • 121
0 votes
1 answer
56 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 ...
user avatar
  • 1,723
2 votes
2 answers
109 views

Finding IntegerPartitions[252] with no zero and no duplicates

Well, I am trying to execute the following code: ...
user avatar
  • 1,723
0 votes
0 answers
47 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?...
user avatar
  • 1,723
0 votes
0 answers
44 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 ...
user avatar
  • 101
4 votes
3 answers
313 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 ...
user avatar
  • 1,723
2 votes
1 answer
151 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), (...
user avatar
5 votes
1 answer
334 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$ ...
user avatar
  • 1,723
2 votes
0 answers
97 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)=...
user avatar
  • 1,723
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$$...
user avatar
  • 1,723
0 votes
1 answer
71 views

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

Well, I am trying to run the following code: ...
user avatar
  • 1,723
1 vote
0 answers
67 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 ...
user avatar
  • 1,723
0 votes
0 answers
32 views

Making a binary number $n$ that must contain $k$ times a $1$ such that `k==GCD[n,IntegerReverse[n]]`

Well, I am trying to code the following thing in Mathematica: I have a binary number $n$ that must contain $k$ times a $1$. So for example: when $k=5$ the following binary numbers does fit the rule: $$...
user avatar
  • 1,723
0 votes
1 answer
168 views

Computing an infinite sum

I wish to compute $$\sum_{n=1}^{\infty} f(n)e^{-nz}$$ where $f(n)= |\{(a,b,c)| abc=n\}|$ and $z>0$. Its easy to compute that if $n = \prod p_{i}^{\alpha_i}$ where $p_i$ are distinct primes then $$f(...
user avatar
  • 101
1 vote
1 answer
74 views

Solving a system of equations using a list of possible solutions

Well, I have for example the following input and output of a code: ...
user avatar
  • 1,723
-1 votes
1 answer
97 views

Create Predicate Function like PrimeQ :: fibonacciQ, pythgoreanQ

Yes, just define the function. i.e. Use the Fibonacci numbers. What are good practices to perform it? (Vague, let's get specific.) Create list of Fib.s 0, to 1,000,000. Make function _Integer ...
user avatar
  • 590
1 vote
1 answer
97 views

Parallel Mathematica-code that runs too slow when running PowerRepresentations[] function

Well, I am a student in elementary number theory and trying to find natural numbers that can be written as the sum of integers to the power of an integer. The code I am using now is the following: <...
user avatar
  • 1,723
0 votes
0 answers
44 views

Solving a system of equations (works with squares not with fifth powers)

Well, I was trying to solve a system of equations in a different question of mine. There @kglr gave a very efficient code for solving that system of equations using squares: ...
user avatar
  • 1,723
-1 votes
1 answer
60 views

Some number theory problem which I want to check via Mathematica

my Programming skills are quite horrendous (I don't work in the industry). I want to check the following problem by programming in Mathematica, so I'd appreciate if someone can chime in and help me ...
user avatar
  • 315
3 votes
1 answer
84 views

Removing a element from list when obeying a certain condition

Well, I have the following code: Select[PowersRepresentations[n, a, b], DuplicateFreeQ[#] && ! MemberQ[#, 0] &] This code finds ...
user avatar
  • 1,723
3 votes
3 answers
246 views

Solving for a unique set of solutions

I have the following code: ...
user avatar
  • 1,723
1 vote
2 answers
181 views

Solve System of congruences

How can I solve a system of linear congruences as such? $$\begin{align*} 3x+2y+28z &= 9 \pmod {29} \\ 5x+27y+z &= 9 \pmod {29} \\ 2x+y+z &= 6 \pmod {29} \end{align*}$$ I tried it this ...
user avatar
  • 389
2 votes
1 answer
95 views

How does Leafcount work? [closed]

I am curious about how LeafCount works because when I count the number of leaves in my solution to a Wolfram Challenge, I get a much smaller result than those listed on the leaderboard for Multiples ...
user avatar
0 votes
1 answer
51 views

How do I convert an encrypted RSA message cipher output into a matrix table?

...
user avatar
  • 31
0 votes
0 answers
71 views

Inverse/Division in finite field?

Think of multiplictavie group of finite field F[p,n], where p is a prime number and n is a positive integer. The whole elements of F[p,n] can be represented as p^n-p^(n-1) positive integers in the ...
user avatar
  • 3,085
6 votes
3 answers
506 views

Prove an inequality over the reals, given a constraint

Given $a,b,c \geq 0$ and $$a + b + c = 3$$ prove $$\frac{a}{b^2 + 1} + \frac{b}{c^2 + 1} + \frac{c}{a^2 + 1} \geq \frac{3}{2}$$ One can prove the above using a great deal of "human" insight ...
user avatar
4 votes
1 answer
289 views

Largest k such that p^k divides n

(Here all variables are integer.) Is there a built-in function f[n,p] such that f[n,p] = largest k such that p^k divides n For ...
user avatar
  • 3,085
2 votes
1 answer
149 views

define edge set of a graph

I want to define a graph in Mathematica which its vertex set is cartesian product of two sets. I define the vertex set by Tuple[] but two vertices are adjacent if and only if the intersection of the ...
user avatar
  • 33
0 votes
1 answer
77 views

Non trivial zeros of Dirichlet L function

So I was wondering if I can find some of the non trivial zeros of the Dirichlet-L function using mathematica. What I found out was there is a code ZetaZero[] which ...
user avatar
  • 195
0 votes
0 answers
99 views

How to implement statistics for the length of continued fractions of a result on MATHEMATICA

After successfully generating the reduced fraction of two coprime in interval (0,1] with the following; ...
user avatar
  • 1
4 votes
0 answers
65 views

Residue for $L(s,\chi_1)$ not same in Mathematica as theoretical value

I want to find the residue of Dirichlet-L function, defined as $L(s,\chi)= \sum_{n=1}^\infty \frac{\chi(n)}{n^s}$ for $Re(s)>1$. We know that $Res_{s=1}L(s,\chi_1)=\frac{\phi(k)}{k}$, where $\chi$ ...
user avatar
  • 195
5 votes
2 answers
127 views

Counting zeros of list from Twin Primes calculation

...
user avatar
  • 590

1
2 3 4 5
9