Questions tagged [largenumber]

Very large numbers often occur in fields such as mathematics, cosmology, cryptography and statistical mechanics. That numbers are significantly larger than those ordinarily used in everyday life, for instance in simple counting or in monetary transactions. The term typically refers to large positive integers, or more generally, large positive real numbers, but it may also be used in other contexts.

In computer science, arbitrary-precision arithmetic, also called bignum arithmetic, multiple precision arithmetic, or sometimes infinite-precision arithmetic, indicates that calculations are performed on numbers which digits of precision are limited only by the available memory of the host system. This contrasts with the faster fixed-precision arithmetic found in most arithmetic logic unit (ALU) hardware, which typically offers between 8 and 64 bits of precision.

Several modern programming languages have built-in support for large numbers (also known as infinite precision integers or bignums), such as , , and . Other languages which do not support this concept as a top-level construct may have libraries available to represent very large numbers using arrays of smaller variables, such as and class or package.

Other languages have libraries available for arbitrary-precision integer and floating-point math. Rather than store values as a fixed number of binary bits related to the size of the processor register, these implementations typically use variable-length arrays of digits.

453 questions
-2
votes
2 answers

Large decimal numbers with function math.modf

I am using the function math.modf which separates the integer and decimal part of a number as follows: decimal_part, integer_part = math.modf(x) Where x is a decimal number. An example for a small number is as follows: x =…
Tucker
  • 1
-2
votes
1 answer

Is there a function to shorten large numbers in python?

I am trying to write an idle game in pygame (with Python 3.8), but it involves putting some pretty large numbers in some small spaces (150x50 pixels). So, I was looking for an answer to my problem by playing other idle games. I noticed that for most…
CheetSheatOverlode
  • 121
  • 1
  • 1
  • 11
-2
votes
2 answers

Why Python is printing bad a huge number?

Good day. I'm testing some things with RSA in Python, and I've found an issue which I can solve... I've tried with Python 3.8.2 on Win10, and also with Python 3.7.7 on Linux. Lets have a number, like: c1=…
NikNitro
  • 29
  • 1
  • 3
-2
votes
1 answer

Scrambled number when access array[10000]

I was looking for solution to question what is the 10001st prime number. And i am done with the code : int main() { long long listNumber[10001]; long position = 1, divider = 0; listNumber[0] = 2; while(listNumber[10000] == 0) { …
-2
votes
5 answers

Last Digit of the Sum of Fibonacci Numbers

I am trying to find the last digit of sum of Fibonacci Series. I calculate the sum as F(n+2) - 1. The below code is working fine but it is slow for large numbers (e.g 99999). How can I optimize this? n = int(input()) def last_digit(n): a, b =…
-2
votes
1 answer

Errors involving precedence of modulus operator and brackets with large numbers in C++

The first part of the just computes some mathematical formula, stroed in ans1, ans2 and ans3. Many sites give % and * as having the same priority in the precedence order. Should we then consider them left to right in an expression? Only difference…
-2
votes
1 answer

How can I handle enormously large numbers in Java?

I'm writing a program for my competitive programming class's homework and I can't get over one problem. This problem requires you to calculate all permutations of a certain string based on certain condition and my program does that. However, the…
leonz
  • 1,107
  • 2
  • 10
  • 32
-2
votes
1 answer

Multiplying two ten digit 32 bit numbers on a 32 bit architecture

I have to read, store, and print two 32-bit numbers on the screen, then multiply them and print the result. I have read the digits of the two numbers, and was able to print them, but if they are big enough, they overflow, not mentioning the fact,…
Tomi
  • 11
  • 2
-2
votes
1 answer

Total amount of increasing and decreasing numbers in a range

Summary An increasing number in this case would be one whose digits are increasing as they move from left to right, such as 14578 and 3489 and 3347778. A decreasing number would be the same, except reversed, such as 84320 and 931. Given a number x…
Spooky
  • 1,752
  • 21
  • 37
-2
votes
1 answer

Python calculating power vs. factorial

I am in university at the moment and one of my subjects is discrete maths. From discrete maths I know that n! > 2^n for n > 3. I know python can calculate 20,000!, I have done it on my computer, granted it takes a few seconds. But it cannot…
-2
votes
2 answers

Sorting large numbers

If one has a list of very very large numbers in Python, so much so that the compiler cannot get the value of them as numbers. Is there a function to sort this list (while keeping the numbers as integers) in a more efficient way such as comparing…
rassa45
  • 3,482
  • 1
  • 29
  • 43
-2
votes
1 answer

find largest value from webelement list

Currently i'm able to print all of them but i want to find out the largest and print only that value. Can anyone please help me in building the code for this in Selenium Webdriver & Java. Here is my code: List Rating = …
-2
votes
3 answers

Java - Calculate with crazy large numbers

How can I calculate with very large numbers in Java. When I say crazy, I mean like 8192 bits integers and floats. Is this possible and what is the maximum an ordinary 64 bit computer can calculate with?
user3854743
  • 511
  • 1
  • 4
  • 9
-2
votes
1 answer

Concentrate 30 integers into a single 64bit integer in C

I have a 20x30 array which contains values of int type. Each row should be concentrated into one number. For example, consider a 3x4 array: |1 3 6 1| |4 2 5 2| |8 3 1 5| It should become: |1361, 4252, 8315| The problem is that, I have 30 numbers so…
Dimitris
  • 7
  • 4
-3
votes
2 answers

Multiplication of 2 numbers with a maximum of 2000 digits

Implement a program to multiply two numbers, with the mention that the first can have a maximum of 2048 digits, and the second number is less than 100. HINT: multiplication can be done using repeated additions. Up to a certain point, the program…