# Tagged Questions

Questions on the number-theoretic functionality of Mathematica.

68 views

### Recursive Euclidean algorithm in Mathematica

Can anyone explain to me how do I use a recursion, if I don't know the limit. For example, I need the remainder r of the Euclidean algorithm for gcd(a,b) which equals 0. I figured out that the ...
588 views

### Proving (or at least 'being told by Mathematica') that Sqrt[2] is irrational?

I realize that Mathematica is not specifically an automated theorem prover. However, this article: http://www.wolfram.com/products/mathematica/newin6/content/EquationalTheoremProving/ Suggests that ...
7 views

### Divisibility by 9 with negative numbers [migrated]

I know that the rule to check divisibility by 9 is to check if the sum of the digits of the number are divisible by 9. But what if the number is negative? Thanks in advance!
74 views

### Finite Field matrix rank calculation

How does one define a matrix over $\mathrm{GF}(p^r)$ in Mathematica in order to compute rank? I am working with $\mathrm{GF}(2)$?
38 views

### Better chances on a gambling game [closed]

I'm working on a program that I hope it will help me to get better chances on a gambling game. I have a very large database of numbers how occur in this game and my program pass through those numbers ...
73 views

### Need help with code for number theory problem

I'm completely new to Mathematica (used previously only for very simple cases). I need to write a quite complex function. The function must do the following: Input consists of two numbers: a and b. ...
90 views

### Using the Baby-Step Giant-Step algorithm

Here is a concept I am working through: As part of an attack on an El-Gamal cipher, solving the discrete logarithm problem $$10^x = 532107 \;\, {\rm mod} \;\, 1313839.$$ Using the ...
38 views

### Factoring large integers with the Pollard p-1 method

I am trying to use the Pollard $p-1$ method to find the factors of a large integer. Here is the problem: An RSA-type cipher is based on the integer $n = 140016480344628383$ and exponent ...
226 views

### On finding all the positive integral solutions of $x^2+y^2=z^2+1$

I am a new to Mathematica. My goal is to find many (if not all) positive integer solutions to the equation: $x^2+y^2=z^2+1$ using Mathematica. However the problem is that I can only find a ...
594 views

### How can FactorInteger be so slow if PrimeQ is fast?

My 8th grade son had a homework problem to find a prime factor of $99!-1$. I thought to be clever/lazy and used FactorInteger[99!-1], but it takes forever. ...
425 views

### Calculating weird numbers

A weird number is a number such that the sum of the proper divisors (divisors including 1 but not itself) of the number is greater than the number, but no subset of these divisors sums to to ...
48 views

### solving quadratic and linear congruences with different modulus

We are able to solve the quadratic congruences $C^2 + Q^4 - 2\equiv mod 3072$ and $C - Q^2 - 2046\equiv mod 3072$ by entering ...
121 views

### Expressing a series formula

I want to generate a series of the following kind in Mathematica: $\quad \quad a(n+1) = a(n) + ({\rm prime}(n+1) - 1)/2 \quad \mbox{for odd primes},$ so that the resultant series is ...
145 views

### Finding primes that have certain property

Let S[p] denote the sum of digits of p. A prime p is said to be stubborn if none of ...
496 views

### Next highly composite number?

R language has this function 'nextn' (link) which computes the next highly composite number greater than a given one, which is used to find the optimal padding size for the subsequent FFT operation. ...
4k views

### What is so special about Prime?

When we try to evaluate Prime on big numbers (e.g. 10^13) we encounter the following issue : ...
808 views

### Why does Mathematica claim there is no even prime?

I wonder if this is a bug, or if I'm misunderstanding something: Exists[n, EvenQ[n] && PrimeQ[n]] // Resolve (* ==> False *) So if I interpret this ...
35 views

### How to “de rationalize” a number? [closed]

How can 1/2 be represented as 0.5? Thanks!
104 views

### Generating Z^*_n

I'm using Mathematica to illustrate basic number theory concepts in a graduate cryptography class. To generate elements of the multiplicative group of integers modulo $n$, i.e. $\mathbb{Z}^*_n$, I can ...
75 views

### Arithmetic on algebraic numbers

I'd like to perform some elementary operations on algebraic numbers. ...
372 views

### Triangular numbers boolean function

I read the new book by Paul Wellin Programming in Mathematica. There is an exercise about triangular numbers. (The n-th triangular number is defined as the sum of ...
171 views

### Code for (a,b) with gcd(a,b)=1?

I am trying to make a big table that includes all ordered pairs (a,b) with a (1,2) (1,3) (2,3) (1,4) (3,4) (1,5) (2,5) (3,5) (4,5) (1,6) (5,6) ... Any ideas? Thanks!
373 views

### What is the confidence limit on this convergence?

When I run this, Product[n^MoebiusMu[n],{n,1,Infinity}] I get $\frac{1}{4 \pi^{2}}$ Over on Math Overflow they are saying it shouldn't happen. So, how do ...
154 views

### Ruth-Aaron quadruple challenge

This a computational challenge, to find an efficient algorithm to discover a quadruple $(n,n+1,n+2,n+3)$ with the same sum of prime factors as described in the MO question, "Ruth-Aaron triples, etc." ...
469 views

### Find the minimum integer r such that $(10^r - 1)/37$ is an integer

I know Element[(10^r - 1)/37, Integers] tests the condition. So what is the command that gives me the minimum integer value r ...
974 views

### Integers which are the sum of both two and three consecutive squares

This is a math problem I came across the other day: $365$ can be written as a sum of two and also three consecutive perfect squares: $365=14^2+13^2=12^2+11^2+10^2$ What is the next ...
362 views

### Better answer to Santa's riddle about sum of a number's divisors?

I was hoping to find an elegant solution to this riddle, using only a line or two of Mathematica: Santa Claus was telling one of his elves: "If I multiply the age of three of my reindeer, I get ...
53 views

### Factoring an ideal in a number field into prime ideals

I'd like to factor an ideal in a number field into prime ideals, exactly as in this example from the Sage documentation: ...
131 views

### Can you compute more terms in this sequence?

I am trying to identify a sequence related to the von Mangoldt function matrix. Since I believe/conjecture that the columns in the matrix have period lengths as in this sequence b: ...
90 views

### Solution of a set of quadratic congruences (Chinese remainder)

Edit: Please remove this question. I think there are mathematics error in what I am asking. You are welcome to edit the question if you can state the problem correctly. I have a set of quadratic ...
84 views

### One of the factors greater than $x$ [closed]

Is there an easy way to tell Mathematica to find one of the prime factors of $n$ greater than $x$. For example, if $n=1299709\cdot 7919 \cdot 17$, is there a way to request a factor greater than ...
124 views

### Mathematica spitting code back when using Resolve over a large range of interest

I've just started using Mathematica and have encountered my first issue. Below are two commands which only differ in the range of values I am asking Mathematica to check. The first works fine, but the ...
280 views

### A problem about fixed point iteration theory

Description Recently, I have been learning a couse called "Numerical Analysis". The fixed point iteration theory was introducted to solve the ...
257 views

### Approximation to the prime counting function

Is there a function similar to PrimePi that gives approximate value for large numbers? In particular, I need a reasonably good approximation for $\pi(x)$, where ...
443 views

### Counting the zeros in a factorial expansion [closed]

A number, as big as 1000! (! = factorial) is given. I need to find how many zeros are there in the number. I counted the no of terminal zeros by dividing 5, 25, 125, ... (untill fifth power < ...
47 views

### Q-Multinomial Coefficient [closed]

How can one compute the q-Multinomial Coefficient as a function of q,m and a list {n1,n2,n3,...} in Mathematica? See http://mathworld.wolfram.com/q-MultinomialCoefficient.html for the definition.
386 views

### the more effective method to find 21 digits armstrong number

In recreational number theory, a narcissistic number (also known as a pluperfect digital invariant (PPDI), an Armstrong number(after Michael F. Armstrong) or a plus perfect number) is a number that is ...
276 views

### Conveying density of 5-smooth (Hamming) numbers

A number is 5-smooth if its only prime factors are 2, 3 or 5. Example: 1, 2, 3, 4, 5, 6, 8, 9, 10, 12, 15, … Interesting thing is that as they become larger ...
262 views

### Write a number as the product of its two largest divisors

For even n >= 10 && n <= 98 I want to write n as the product of its two largest divisors (excluding ...
1k views

### A question regarding 1 divided 243

Here is a problem due to Feynman. If you take 1 divided by 243 you get 0.004115226337 .... It goes a little cockeyed after 559 when you're carrying out the decimal expansion, but it soon straightens ...
767 views

### Write any positive integer as a sum of squares

With n = 17 I would like to get {4, 1} and with n = 999 {31, 6, 1, 1} so that, for example, ...
103 views

### Symbolic multiplicative partitions

Let $p_n\#\equiv\prod_{k=1}^{n}p_k$ (primorial): p[n_] := Times @@ Prime[Range[n]] then the multiplicative partitions of $p_{1,2,3,4}\#$ are $$\{\{2\}\},$$ ...
2k views

### Factorisation diagrams

Here is a way to visualize the factorisation of natural numbers. How do we get this or a similar kind of output using Mathematica? See the list of images generated for number from 1 to 36:
114 views

### Testing the Erdos square free conjecture

Can someone please answer these two parts of my homework assignment? Adding an explanation would be appreciated! a. Test the Erdos square free conjecture for $n <= 30000$. You should use ...
234 views

### Elliptic curve cryptography in Mathematica

I can find no resources for doing elliptic curve cryptography. I have used the finite field package, but I find it cumbersome and it does not seem to have any builtin methods for ECC. How can I get ...
63 views

### Square root of a value defined in a finite field?

I am trying to find the right way to compute the square root of a number defined in a finite field. For example, ...
103 views

### How to calculate the residue of $1/f(z)$ at a numerical approximation to a root of $f(z)$?

The input Residue[1/DirichletL[19,10,s],{s,s0}] gives 0 even when s0 is a root. For ...
90 views

### Simplifying expressions involving Divisible

FullSimplify[ Divisible[p^2 - 1, 24] , Element[p, Primes] && p > 3] Should evaluate to True, but I get ...
How can I factor 'integers' over other quadratic number fields (not just gaussian integers). For instance, how could I factor $7 = (3 + ω)(2 − ω)$ over Eisenstein integers (\$ω = \frac{-1+ I ...