Questions tagged [number-theory]

Questions on the number-theoretic functionality of Mathematica.

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

Identifying repeating patterns in a list of numbers

I have some generated lists of natural numbers which have a small number of distinct values, ie. referencing the variable "rowToCheck" for each list: list1: rowToCheck = 3: length=7, distinctvalues=3 ...
1
vote
1answer
56 views

Is there a function or a way of getting a remainder or modulus with equations with “surds”?

So I'm working with "surds", or radicals. I have expressions like $$7 + 5\sqrt{2} + 6\sqrt{3} + 7\sqrt{6}\tag{1}$$ and I want to take the "coefficients", for lack of a better word, and take their ...
1
vote
1answer
69 views

Finding the maximal number of lists that form certain rules?

I have the following example: data={1, 2, 3, 4, 5, 6, 7, 8, 9}; NN=Length[data]/3; subdata=Subsets[data, {3}]; I want to know all the possibility for the ...
4
votes
2answers
389 views

Drawing a sequence of circles

For every natural number from 1 to 150, draw a circle centered on the x-axis in that number and with the diameter equal to the number of divisors of the number. I don't know what should I do.
3
votes
2answers
185 views

solve for two variables for each n related to Collatz conjecture

For this code, for each x I would like to solve for all value ranges for c1 and c2 in a bounded range ie c1 and c2 in the range of real numbers +-100 for c1 and c2 for each x, which combined give "...
-1
votes
1answer
174 views

automatic formula finding function [duplicate]

I am curious how easy it would be to automatically find some formulas related to basic number theory OEIS sequences using some Mathematica search algorithm for a small set of OEIS sequences as a ...
2
votes
1answer
44 views

Prime factorization related functions: prime factor to its power and power of prime [duplicate]

FactorInteger can be used to perform prime factorization: FactorInteger[5^2 7^3 11^4] Results in: ...
6
votes
1answer
48 views

Abelianness-forcing number Q

In the theory of finite abstract group, abelianness-forcing number $n$ is characterized as a positive integer with standard factorization $n=p_1^{k_1}p_2^{k_2}\cdots p_r^{k_r}$ with $k_i \le 2$ and $...
10
votes
1answer
210 views

How to calculate $\displaystyle \prod_{p}\frac{p^2+1}{p^2-1}$?

When I input $$ \prod _{p=2}^{\infty } \text{If}\left[\text{PrimeQ}[p],\frac{p^2+1}{p^2-1},1\right] $$ in Mathematica 12.0, it gives out the value $1$. The result is ridiculous, for that according to ...
2
votes
0answers
38 views

FindEquationalProof to prove divisor theorem

I'm trying to implement proofs of concepts for Equational Proofs on some basic number theory theorems. One such example is: "let a and b be positive integers and let d = gcd (a, b). If t divides ...
3
votes
1answer
110 views

Number theory in Mathematica

Is there any book out there similar to S. Wagon's Mathematica in Action that has problems/exercises/projects in the field of number theory as done in Mathematica? If not pure number theory, at least ...
0
votes
2answers
202 views

Request code for creating sequences [closed]

I would like to have Mathematica code for creating the following sequence shown as rows: ...
6
votes
3answers
370 views

How to do this Padovan spiral using Mathematica?

how to do this unusual pendovan spriral? can anyone help me ?
0
votes
1answer
52 views

Recurrence involving a product of recurrents

I can solve the following recurrence problem as follows: ...
0
votes
1answer
39 views

Expanding integer compositions

Quick version: I would like Mathematica code that, for instance, turns {3,1,2} into {3,3,3,1,2,2}. More formally, given positive integers $c_1, \ldots, c_t$ which sum to $n$, produce the length $n$ ...
0
votes
5answers
104 views

Sum Over Solutions to an Equation

Two Related Questions Is there any general built-in functionality for computing a sum over solutions to an equation? This is common in number theory. For example, computing sums of the following form....
9
votes
6answers
673 views

How can I plot a Farey diagram?

How can I plot the following diagram for a Farey series?
0
votes
1answer
39 views

Reverse the reccurence mirrorwise

Let be a recurrence for polynomials $R_{m,j}$ ...
2
votes
2answers
129 views

Displaying the number of repeating digits in a fraction

I would like to check how many repeating digits are in a large fraction, I manually did it for the first few, but the repeating length is too large to manually check. ...
0
votes
2answers
48 views

Running a loop to check for multiple congruences

I have the code for a loop to run. Right now it can check if a number is a square and at the same time check if it is congruent 0 mod 47. My questions is, how can I alter the code to see if it is ...
2
votes
1answer
165 views

Rewrite the power sum in terms of convolution

Let be an identity $$n^{2m+1}=\sum_{r=0}^{m}A_{m,r}\sum_{k=0}^{n-1}k^r(n-k)^r,$$ where $A_{m,r}$ are real coefficients, see A302971 for numerators and formula of $A_{m,r}$. Here we can notice that $\...
4
votes
1answer
869 views

Why does Solve lock up when trying to solve the quadratic equation with large integers?

Why does Solve lock up when trying to solve the equation ...
0
votes
0answers
64 views

Most efficient way to define evil and odious numbers [duplicate]

A positive integer $n$ is defined to be evil if the number of ones in its binary expansion is even, otherwise it is odious. Now define the function $$ \begin{equation*} t(n)= \begin{cases} 1 \rm{ \...
2
votes
1answer
85 views

My version of PowerMod breaks down around 10^308

I have been trying to write a function that duplicates PowerMod[a, b, n], computing a^b mod n...
3
votes
1answer
181 views

Table of Chebyshev psi function

This should be easy, but for some reason I'm struggling. The Chebyshev psi function is given as the sum from 0 to x of the von ...
3
votes
1answer
83 views

List of invertible congruence classes

I am attempting to create a list of the invertible congruence classes $\bmod 120$. The code I have is ...
1
vote
2answers
61 views

Using a Do-loop to find divisors mod 13 [closed]

I want to check sum of divisors of i mod 13 fori = 1 to i = 20. I tried writing a Do-Print ...
2
votes
1answer
123 views

Mathematica code for computing the $p$-adic expansion of rational numbers

Does anyone know any Mathematica code for computing the $p$-adic expansion of rational numbers? I.e. given a rational number $a/b,~a,b\in \mathbb{Z}$ and a prime number $p$, then compute the $p$-adic ...
6
votes
1answer
89 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 ...
5
votes
0answers
104 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 ...
3
votes
2answers
826 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
388 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
75 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
71 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
329 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
151 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
148 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
75 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
27 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
466 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
104 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
40 views

FunctionDomain in the Reals numbers [closed]

Why don't I obtain that $x$ belongs to the Reals? ...
-2
votes
2answers
88 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
91 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
326 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
54 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
44 views

Question about using ParallelMap to speed up computations [duplicate]

First; I define two functions: ...
0
votes
2answers
107 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?
4
votes
2answers
117 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 ...