Questions tagged [big-numbers]

Questions about or involving outside the range of normal machine precision, using Mathematica's capacity for arbitrary precision numbers and numbers outside the normal range of floating-point arithmetic.

Filter by
Sorted by
Tagged with
5 votes
2 answers
632 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
  • 989
2 votes
1 answer
103 views

How can I make sure that the two given numbers are exactly the same?

I have the given numbers $n1$ and $n2$. How can I make sure that these two numbers are exactly the same? Numerically, using {N[n1,40], N[n2,40]}, by increasing the ...
Phys96's user avatar
  • 361
13 votes
1 answer
225 views

Performance regression for big integer computation

Backslide introduced in 12.0, persisting through 13.1. Recently I noticed that the big integer calculation of the new version is much slower than the old version, can you reproduce, is there a way to ...
expression's user avatar
  • 5,562
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
4 votes
3 answers
328 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
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
86 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
110 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
4 votes
3 answers
263 views

Why $\pi$ // Rationalize does not give a rational multiple of $\pi$ in my example?

As an obvious example of π Rationalize, I see that ...
charmin's user avatar
  • 1,159
2 votes
1 answer
86 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 ...
Turbo's user avatar
  • 145
1 vote
2 answers
67 views

Filtering solutions in PowerRepresentations

I have the following code: PowersRepresentations[10400, 7, 2] This produces Length[PowersRepresentations[10400, 7, 2]]=433789 ...
Jan Eerland's user avatar
  • 1,941
2 votes
1 answer
97 views

Help: Obtain a huge amount of data solved in FrobeniusSolve? (perhaps better without running FrobeniusSolve?) [closed]

How to obtain a huge amount of data solved in FrobeniusSolve more systematically? I am interested in obtaining these two sets of data from FrobeniusSolve: ...
wonderich's user avatar
  • 903
1 vote
1 answer
96 views

Solving an equation in integers giving an error message

I've the following code: ...
Jan Eerland's user avatar
  • 1,941
1 vote
1 answer
264 views

Using more than 6 kernels in ParallelTable function [duplicate]

I have the following code: ParallelTable[ If[IntegerQ@Sqrt[80892036 + 17994 x (1 + x) (-5995 + 5998 x)], x, Nothing], {x, 6694300, 31072325}] It uses 6 ...
Jan Eerland's user avatar
  • 1,941
2 votes
1 answer
277 views

Using Parallelize in a solve function

Is there a way to use Parallelize the following operation, in order to make it do the calculations faster? Or is there another way to speed up this calculation? ...
Jan Eerland's user avatar
  • 1,941
3 votes
2 answers
223 views

Using the solve function for big numbers, getting a failure now

When I try to solve: Solve[y^2==441+48*x*(1+x)(-13+16*x)&&1100*10^9<=y<=1200*10^9&&x>=2,{y,x},Integers] My code runs for 169 seconds and ...
Jan Eerland's user avatar
  • 1,941
3 votes
1 answer
292 views

How to get the bit size (bit length) of an integer? [closed]

Suppose I have the integer 255, so 11111111 is its base 2 (bit) representation and the bit size of 255 is 8. How can I calculate the bit size of a (big) integer in Mathematica? Is there a built in ...
Diego Olvera's user avatar
0 votes
0 answers
118 views

Sum of digits of large numbers with a particular form

I used Wolfram Alpha to find the sum of digits of these large numbers but the results are " standard computation time exceeded ". Could you help me because I want investigate these four numbers: $((...
Hashirama's user avatar
4 votes
3 answers
271 views

How to plot a function with huge numbers?

I have a huge polynomial function P which is dependent on x, I tried plotting the function but I am getting nothing in the plot. ...
acoustics's user avatar
  • 1,699
2 votes
0 answers
173 views

How to deal properly with big integer limitations [closed]

I need to run an algorithm that manipulates digits with big integers and integer functions, And I need to be careful to avoid erroneous results in my research. It is not necessary to answer every ...
Noir's user avatar
  • 121
8 votes
2 answers
192 views

How to prevent spikes in memory usage during simple numerical evaluation?

I've noticed strange peaks in memory usage (several GB) during evaluation of my code, sometimes freezing operating system. Nailed it down to numerical evaluation of "bignum" expressions like this: <...
Andrzej Odrzywolek's user avatar
3 votes
3 answers
193 views

How to stop calculating if there're some large number?

I want to calculate something like o[n, o[n, o[n, n]]] Where n means a number and o means a ...
Aster's user avatar
  • 3,816
1 vote
1 answer
234 views

How to loop through a large number in mathematica

I am trying to find all divisors of 200! [Project Euler, problem 608 - in case anybody is curious]. It has many divisors and hence using ...
babbupandey's user avatar
1 vote
1 answer
59 views

Code needed to determine the smallest k that the equation will fail by brute force [closed]

I find one of the suggested solution to this problem a little bit questionable: “If N is divisible by 1, 2, 3,. . . M, then N must also be divisible by M + 1, M + 2, M + 3, . . . M + k for k is a ...
rosa's user avatar
  • 111
0 votes
0 answers
232 views

Algorithm that will trim a unique ID number and produce a shorter unique ID

I have a unique ID number with 2^128 magnitude length (128 bits). This means ~3.4e+38 which is quite large that my actually needs, spending valuable time in a transmission protocol. There is a ...
user1797147's user avatar
6 votes
2 answers
922 views

Is there a command that does exact numerical conversion of non-exact to exact numbers?

I generally prefer to do all my intermediate calculations with exact numbers, and then round my result at the end. Thus I will typically convert each arbitrary-precision number to its exact equivalent;...
theorist's user avatar
  • 3,603
0 votes
2 answers
535 views

Integrate over sharp peak [closed]

Hi I have a function that has a sharp spike. I need to NIntegrate over the peak but it seems that NIntegrate does not handle it well. Actually as far as I can tell, even the evaluation of the ...
C. Sun's user avatar
  • 1
0 votes
0 answers
30 views

How to solve equations in Gaussian integers modulo p efficiently [duplicate]

This question is related to my previous question which can be found here. Calling the function sols1 = gaussianPowerModList[I, 8192, 18446744069414584321];] ...
caesar's user avatar
  • 111
1 vote
2 answers
444 views

How to solve equations in Gaussian integers modulo p

How to solve a complex equation of the form: $$z^n \equiv i \pmod p$$ where $z$ is a Gaussian integer, $i$ is the imaginary number, $n, p \in \mathbb{Z}^+$ and $p$ is prime. I am dealing with quite ...
caesar's user avatar
  • 111
3 votes
2 answers
209 views

Plot for big x numbers

I want to make a plot of data with big values by x. My code is this ...
Zlelik's user avatar
  • 531
6 votes
1 answer
130 views

Exporting large numbers to .PDF file

For educational purpuses I sometimes print out large or interesting numbers for young mathematicians participating in classes. The numbers are generated in Mathematica. I have tried simply copying ...
Michael Freimann's user avatar
10 votes
2 answers
526 views

Efficiently checking whether a number is a perfect power

Goal The goal is to efficiently check whether a number is a perfect power. Attempts It is possible to check whether a number is a perfect power using ...
JungHwan Min's user avatar
  • 4,644
11 votes
2 answers
1k views

Number of digits for factorial of 12345678987654321

What is the number of digits (IntegerLength) of the factorial of 12 345 678 987 654 321? The number of zeros at the end of this factorial was calculated and it is huge: exactly 3 086 419 746 913 569 ...
Giorgio's user avatar
  • 351
4 votes
1 answer
425 views

How to generate random natural numbers in $[1, \infty)$? [closed]

Functions like RandomInteger draw random variates from a finite range. Can one also obtain random natural numbers in case the range extends from 1 to infinity? If ...
mespuelas's user avatar
2 votes
1 answer
103 views

Is the arbitrary base that can be defined by IntegerLength[n,base] really limitless?

I am going to be working with very large numbers, and would like write the input in the base 10 and have the computer output in another arbitrary base. If it truly is limitless, that would be awesome ...
user24719's user avatar
  • 137
3 votes
1 answer
302 views

Datatypes and numbers in Mathematica

I have some questions about numbers in Mathematica: Does Mathematica work with datatypes like int, long, ...
user avatar
21 votes
1 answer
1k views

Faster binary Hamming weight for big integers?

While working on an answer to Count the sequences in an array I found that DigitCount was the bottleneck in my code when used as ...
Mr.Wizard's user avatar
  • 270k
4 votes
1 answer
289 views

How to further accelerate arithmetic with Fermat Pseudoprime and Fibonacci number

I've been working on this all night, and I have made this go pretty fast, compared to my first iteration of the program, but now I'm out of ideas. I'm trying to write a program to test (by good old ...
William Henry Langhoff's user avatar
1 vote
1 answer
846 views

How do I find my maximum precision on my computer? [duplicate]

I'm trying to run this ...
user24719's user avatar
  • 137
6 votes
4 answers
17k views

How to calculate extremely large exponential

I would like to calculate the following nested exponential: $$ \Large{e^{e^{10^{72}}}} $$ In case that might be hard to read, in Mathematica functional notation it is: ...
K7PEH's user avatar
  • 609
1 vote
3 answers
2k views

The biggest exponent that can be computed

I am struggling with my crypt assignments and constantly getting overflow errors. Below is a simplified version of the problems I am experiencing ...
OScam's user avatar
  • 13
1 vote
1 answer
549 views

How can I export numerical data in a calculation-favorable format?

I am exporting some data into the txt file but since the values exported to this txt file expresses 10^6 to be *^6, I cannot use these numbers in calculations in other programs.. For instance, when I ...
Eric's user avatar
  • 219
1 vote
0 answers
993 views

How to work with large numbers

How do I browse very large numbers in mathematica, say $10^{{10}^{{10}^{1.414\ldots}}}$? By browse I mean finding the $k$th decimal place before or after the decimal point. Everything I have tried ...
user85798's user avatar
1 vote
0 answers
77 views

Comparing large numbers [duplicate]

How can I compare really large numbers in Mathematica? I'm trying to compare: 2^4^4^4 < 4^4^4^4 It yields: ...
m0nhawk's user avatar
  • 3,857
2 votes
1 answer
121 views

Read return value as string by Mathlink.h

I'm using "mathlink.h" to call Mathematica from a C program. I send a computation to Mathematica and its return result is a very big number (100 digits). Hence, I want to read that number as a string. ...
Loi.Luu's user avatar
  • 415
4 votes
1 answer
679 views

Strange behavior on very large numbers

I want to test the value of a differential equation by replacing a solution and setting random values for r and z variables: ...
Giovanni F.'s user avatar
  • 1,911
6 votes
2 answers
444 views

Can we compile using only Integers Of Unusual Size?

I coined Integers Of Unusual Size to mean "bignum" using GMP, the underpinning of Mathematica's ability to craft very big numbers. I have these functions from this question: ...
Fred Daniel Kline's user avatar
41 votes
1 answer
3k views

How to compare power towers in Mathematica?

First I tried it directly, but it overflowed: ...
Piotr Shatalin's user avatar
4 votes
2 answers
710 views

Fast Trial Division

I'm going to write a custom Trial Division primality test. I know that PrimeQ will first try trial division and then switches to ...
Mohsen Afshin's user avatar
6 votes
2 answers
992 views

Fast Karatsuba Squaring, how to?

I want to improve timing of squaring for big numbers. So I asked What is the fastest way to split a number into parts and What is the most efficient way to add zeros to end of a number with several ...
Mohsen Afshin's user avatar