Questions tagged [number-theory]

Questions on the number-theoretic functionality of Mathematica.

Filter by
Sorted by
Tagged with
0
votes
0answers
23 views

Let a,b ∈ Z and gcd(a ; b)=5. What are the possible values for gcd(ab ; 5a − 10b) [closed]

I try to use the Euclidean algorithm but the factor ab is the problem to simplify
3
votes
1answer
159 views

Using dynamic programming to compute an integer sequence

Let a[n] = n + 1 - a[EulerPhi[n]], n integer > 0. I have Python code that generates the sequence using dynamic programming. How can I achieve the same thing elegantly/idiomatically in Mathematica? ...
0
votes
0answers
43 views

Finding if a number is perfect square [duplicate]

I used the following code to found if a specific number is a perfect square: ...
0
votes
0answers
43 views

Do these solutions actually amount to a solution over the Reals and not over the Complexes as Mathematica says?

The following program outputs approximations to ZetaZero[1] and ZetaZero[-1]: ...
1
vote
1answer
34 views

Manipulate giving errors when I plot the product of a step function and a continuous function

Riemann's prime counting function J (link) takes half-values at every jump-discontinuity. So, I define it thus: ...
2
votes
1answer
49 views

Find values of n for which expression is integer

I have an expression for which I want ot find values of n that will make it an integer. Here is the expression: (n^(3/2) - n)^(1/3) or n^(1/2) - n^(1/3) I want to ...
1
vote
2answers
93 views

Solving a diophantine equation in 'large' values

Let's first discuss what I am trying to solve: I want to solve the diophantine equation stated below for relatively 'large' values of $r$. $$\frac{a(a + 3)(a(r - 9) + (7 - r))}{12}=\frac{b (3 + b (-5 +...
3
votes
1answer
105 views

How to ask Mathematica to range all the natural numbers $1<n<500$ which are not multiples of 5? [closed]

How can I ask Mathematica to range all the natural numbers $1<n<500$ which are not multiples of 5? I mean I need to get $$\{1,2,3,4,6,7,8,9,11,12,13,14,16,...,499\}$$
2
votes
3answers
94 views

What is the probability of the digit $k$ in the number $x^n$

Well, the title of the question says it all: how to write a code that finds the probability of the digit $k$ in the number $x^n$? For example, when $x=2$, $n=100$, and $k=7$ we are trying to find how ...
1
vote
5answers
97 views

How to find the 2 smallest integers that is divisible by 40131 and 41405 [closed]

I'm trying to find the two smallest integers that is divisible by 40131 and 41405, i.e 40131|a, 41405|a, 40131|b and 41405|b. There is a hint within the question that says you can use FactorInteger[] ...
3
votes
2answers
77 views

using DeleteCases with CoprimeQ

first let me show what I have working correctly f = Permutations[Range[5], {3}] Riffle[f, Apply[CoprimeQ, f, {1}]] now I would like to automate the deletion of a ...
3
votes
4answers
336 views

Solving an equation in natural numbers

I am trying to solve the following equation in the Natural Numbers, with the condition $a\ge1$, $b\ge1$, and $r\ge3$: $$\frac{a(a + 3)(a(r - 5) + (12 - r))}{9}=\frac{b (9 + b (-14 + r) - r)}{3}\tag1$$ ...
4
votes
2answers
147 views

Finding the number of even numbers in Pascal's triangle (code gives memory error)

I have the following code: ...
2
votes
1answer
80 views

How to write this simple task of unimodular prime search in mathematica?

For testing a particular algorithm I found mathematica is the best way as it has all the tools I need. I am stuck in a number theory part and since I am not an expert in mathematica I do not know how ...
5
votes
1answer
111 views

RSA encryption/decryption with signed message

I was going through a book with some tasks that you can work with mathematica on, and I found this particular task interesting: Proffesor Alice has sent an assignment to Bob, one of her students. To ...
3
votes
2answers
179 views

Exact division and geometric sequences

I imagine this problem has a name that I don't know; it's probably some sort of exact division problem. Here goes: imagine you have to divide 4 cookies among 11 people. Divide the cookies equally ...
1
vote
0answers
57 views

FactorInteger snippet works, but use of Sow/Reap/Print is clunky

This is a code review or de-clunking request. If it doesn't belong here, I'll withdraw it. The below toy works and produces the proper output, that is, for numbers to be factored that can be expressed ...
0
votes
1answer
107 views

Writing a program that finds for what $(x,y)$ a function gives a perfect square number

The overal question I am trying to answer is: For what $(x,y)$, which are positive integers, is the following number a perfect square number? $$9 \left(x^3 (y-2)^2+3 x^2 (y-2)-2 x (y-45) (y-2)+7 (y-1)^...
1
vote
1answer
55 views

A modular version of LinearRecurrence?

I'm playing around with implementing the Lucas probable prime test (mainly so I can understand it better), and would love a version of the LinearRecurrence function that used addition modulo n (with n ...
0
votes
1answer
55 views

How to get smooth numbers efficiently by using dependent iterators in Table

I have the following code for getting smooth numbers up to Prime[4] : ...
2
votes
0answers
60 views

How do we add up length of sub-intervals whose start-points belong to fractions with an even or odd denominator less than $n$?

Suppose we divide $[0,1]$ into sub-intervals whose start-points contains fractions in $[0,1]$ with a denominators less than integer $n$. Then suppose we add the lengths of sub-intervals whose start-...
2
votes
1answer
85 views

Least common multiple and greatest common divisor problem.What instruction to use?

Here we have an equation in two variables that involves the greatest common divisor and the least common multiple, I can't think of what else to use. $$Reduce[(LCM[x, y])^2 + (GCD[x, y])^ 2 == 900]$$ $...
2
votes
2answers
56 views

Creating a Table with varying depth and interdependent limits

As an example I want to find all Integers up to a given limit which only have certain prime factors. I can do it efficiently for the case of 2, 3, and 5 by ...
4
votes
0answers
79 views

Prime factorization over the Eisenstein integers $\mathbb{Z}[\zeta]$

I am trying to write a function f[a_,b_] which takes in two integers $a,b$ and returns the unique factorization of $a+be^{2\pi i/3}$ into the primes belonging to $\...
0
votes
0answers
54 views

Analytic continuation of the prime zeta function

I want to plot the real part of the prime zeta function over the imaginary axis. This should be doable since the prime zeta function has an analytic continuation up to the imaginary axis. However, ...
1
vote
0answers
29 views

Generating a list of the degree-$n$ Kronecker polynomials

A Kronecker polynomial is a polynomial such that Its coefficients are integers, Its roots are on the unit circle or $0$, Its leading coefficient is $1$. From here, there are finitely many Kronecker ...
1
vote
2answers
53 views

Filtering solutions in PowerRepresentations

I have the following code: PowersRepresentations[10400, 7, 2] This produces Length[PowersRepresentations[10400, 7, 2]]=433789 ...
1
vote
0answers
59 views

Is there some programs about the fast inverse descrete time Fourier transform

At first, I give the definition of the inverse discrete-time Fourier transform $$\phi(s)=\frac{1}{2\pi}\int_{-\pi}^{\pi}\exp(iks)f(k)dk$$ Here what I use is ...
1
vote
0answers
18 views

Question about AsymptoticEqual[nChebyshevPsi[x], x, x -> Infinity]

Given the partial sum function nChebyshevPsi[x_] := Sum[MangoldtLambda[y], {y, x}] I would like a True response from ...
4
votes
2answers
130 views

How does `DirichletConvolve` relate to Dirichlet convolution?

Mathematica's Help documentation on DirichletConvolve is economical, to say the least. It claims the function "gives the Dirichlet convolution of the ...
5
votes
3answers
348 views

Writing a program that divide numbers until I hit a one digit number

Well, I have the following question: How can I write a program such that an input number $n$ is divided by the number $k$ as long as the resulting number does not have one digit, if the resulting ...
3
votes
1answer
65 views

About a problem with FromDigits

I have tried FromDigits[{{1, 2, 3, 4},{2,3, 4, 1}, {3, 4, 1, 2}, {4, 1, 2, 3}}] and the result is as expected {1234,2341,3412,4123}. However for ...
4
votes
1answer
208 views

Is there an efficient way to calculate last digits of this sum?

Is there a more efficient way to find the last digits of the following sum for any n? $1 + n + n(n-1) + n(n-1)(n-2) + ... + \frac{n}{2!} + n!$ The method I currently use to find the last $d$ digits ...
2
votes
0answers
47 views

Dirichlet L-function associated to Kronecker symbol

The Fourier coefficients of the genus 2 Eisenstein series on the Siegel upper half-space are given by sums over Cohen functions. The Cohen function contains as a multiplicative factor a Dirichlet L-...
1
vote
1answer
31 views

Where To Start; Numbered Triangle

I am working on a square matrix. Cell (1,1) starts at 1, and each following 2, then 3, .., working x to y order. Plus, each cell is computed after this, to Sum of Squares minus Sum of each cell. Sorry,...
3
votes
0answers
77 views

PowerModList anomaly

This post is related to Not comprehending PowerMod. Here the issue is that PowerModList, in v. 12.1 finds no cube roots of 1 Mod 10^60 - 1: ...
2
votes
1answer
95 views

Euler Numbers A000295 And Basic MMA Code

When I run this snippet in MMA ...
0
votes
0answers
38 views

Arrange the output by 3-adic valuation

I have a number that has the form $x=\sum_{k=1}^n c_k3^{q_k}$, where $q_k\in\mathbb{Q}$ and $0\neq c_k$ is in $\mathbb{Z}$ or $i\mathbb{Z}$. We may define the $3$-adic valuation of $c_k3^{q_k}$ as $...
3
votes
1answer
57 views

Math related program

Hi I am wondering for a program that can check when the sums of divisors of an odd square number will be equal to the sums of divisors of powers of 2. So when does $$\sigma(n^2)=\sigma(2^k)$$
0
votes
0answers
67 views

Numerical comparison of two integrals and a function :

Consider the following integral: $$S(q)=\int_{x=2}^q\sin^2\left(\frac{π\Gamma(x)}{2x}\right)dx$$ And consider the functions : $$R(q)=\frac{q}{\log(q)}$$ $$T(q)=\int_2^q\frac{1}{\log(x)}dx$$ I ...
4
votes
1answer
126 views

Consider all numbers, from two-digit up to 10-digit, written only with digits 1, 2, 3, 5, 7. Identify those that are perfect squares

Consider all numbers, from two-digit up to 10-digit, written only with digits 1, 2, 3, 5, 7. Identify those that are perfect squares I got this problem but don't know how to solve it. This is what I ...
0
votes
2answers
94 views

Solving a system of equations using the data generated by PowersRepresentations and ParallelTable

First of all, it is possible to check the code that I am asking for because I know that $x=3051$ must yield at least a solution to the problem. Well, I have the following system of equations: Now, I ...
4
votes
4answers
527 views

Fibonacci sequence questions

I want to show that "Out of the first 450 Fibonacci numbers, the odd number is twice as many as even number." with Mathematica. Can you solve it please?
3
votes
1answer
86 views

Does AsymptoticSum work with Arithmetical Number Theoretic Functions?

The recent function AsymptoticSum works as follows: AsymptoticSum[1/k, {k, 1, n}, n -> \[Infinity]] with expected result: ...
1
vote
3answers
89 views

How to find a number that multiplied to a list, returns an all-integer list

I do not know how to code the following. Suppose you have a list lst={x1,...,xn}and you need to find a number $Z$, to a given digits precision such that ...
0
votes
1answer
41 views

Problem with Real Digits and and getting the sum of digits [closed]

I want to find the sum of the digits of the first 30 000 multiples of 31. I started by first finding the multiples. Like this: ...
0
votes
1answer
110 views

Sampling two integer lists of given sizes from a distribution that have equal sums

(This question emerged from discussions in this post.) Context and code sample: I am trying to figure out if there is a way to generate two $a$ and $b,$ comprised of $n_a$ and $n_b$ integers which ...
1
vote
1answer
53 views

Calculating a sum indexed by $t|gcd(m,n)$

I would like to know how to implement the sum $$f(m,n)=\frac{1}{n}\left(\sum_{t|gcd(m,n)}{\frac{m}{t}+\frac{n}{t}-1 \choose \frac{m}{t}}\phi(t)\right)$$ for two given positive entires $m, n$. Here, $\...
5
votes
3answers
154 views

Among the first 10,000 multiples of 17

Hello I'm new with Mathematica and I can't find a way where I can do this condition. Among the first 10,000 multiples of 17 how many have the sum of their digit multiple of 17? The part for the ...
4
votes
1answer
58 views

Condition for an integer exactly three primes factors? [closed]

I would like to count the number of integers n in the range [1, 10000] that satisfy all three of the properties below: n has ...

1
2 3 4 5
8