# Wanted: A calculator that can handle really big integers and fractions

## Summary:

I need a calculator that can handle fractions with really large denominators
I am trying to get one step further with my search for $\sum_{n=1}^{\infty}\frac{1}{n^{2s+1}}$. Part of the way is to calculate some algebraic expressions containing fractions with really huge numbers (as in $(\frac{1}{5^{9}}+\frac{1}{7^{9}}-\frac{1}{17^{9}}-\frac{1}{19^{9}})\div (\frac{2}{6^{9}}-\frac{2}{18^{9}})$). Does anybody know of such a calculator or do I have to write it myself?

Yes, I know about mpir.org, but they are based on 64-bit numbers which is too small for me (since 5, 7, 17 and 19 are all prime numbers, adding the fractions will end up in a really huge denominator).

Related Computing and Technology News on Phys.org
Filip Larsen
Gold Member
Perhaps one of the arbitrary precision online calculators will do?

Example from my first search hit (notice result is a fraction):
https://apfloat.appspot.com/:
(1/(5^9)+1/(7^9)-1/(17^9)-1/(19^9))/(2/(6^9)-2/(18^9))
80281486442205051414723549292278888963072/29680713166750710362839900905033947265625

• davenn
jedishrfu
Mentor
Why not use python? Big integers are baked in.

As an example:

Python:
\$ python

>>> 2**500
3273390607896141870013189696827599152216642046043064789483291368096133796404674554883270092325904157150886684127560071009217256545885393053328527589376L

>>> 2**5000
141246703213942603683520966701614733366889617518454111681368808585711816984270751255808912631671152637335603208431366082764203838069979338335971185726639923431051777851865399011877999645131707069373498212631323752553111215372844035950900535954860733418453405575566736801565587405464699640499050849699472357900905617571376618228216434213181520991556677126498651782204174061830939239176861341383294018240225838692725596147005144243281075275629495339093813198966735633606329691023842454125835888656873133981287240980008838073668221804264432910894030789020219440578198488267339768238872279902157420307247570510423845868872596735891805818727796435753018518086641356012851302546726823009250218328018251907340245449863183265637987862198511046362985461949587281119139907228004385942880953958816554567625296086916885774828934449941362416588675326940332561103664556982622206834474219811081872404929503481991376740379825998791411879802717583885498575115299471743469241117070230398103378615232793710290992656444842895511830355733152020804157920090041811951880456705515468349446182731742327685989277607620709525878318766488368348965015474997864119765441433356928012344111765735336393557879214937004347568208665958717764059293592887514292843557047089164876483116615691886203812997555690171892169733755224469032475078797830901321579940127337210694377283439922280274060798234786740434893458120198341101033812506720046609891160700284002100980452964039788704335302619337597862052192280371481132164147186514169090917191909376L

>>> 2**50000  // is left to the OP to try out.
...

• • jim mcnamara and FactChecker
pbuk
Gold Member
Yes, I know about mpir.org, but they are based on 64-bit numbers.
Is that true? mpir is based on GMP and that caters for arbitrary size integer (numerator, denominator) pairs.

If you just want an online calculator then Wolfram Alpha is the obvious first stop - the answer is apparently $$\frac{80,281,486,442,205,051,414,723,549,292,278,888,963,072}{29,680,713,166,750,710,362,839,900,905,033,947,265,625}$$
if I copied it correctly.

For many other online calculators and libraries in your favourite language (most of which link in GMP), search for "arbitrary precision rational arithmetic" (or just e.g. "rational arithmetic python").

Why not use python? Big integers are baked in.
Well Big Integers are not very helpful here, but fortunately Python also has Fractions baked in Is that true? mpir is based on GMP and that caters for arbitrary size integer (numerator, denominator) pairs.
You may well be right, I just scanned through a couple of the header files and only found paragraphs dealing with long and long long.

You may well be right, I just scanned through a couple of the header files and only found paragraphs dealing with long and long long.
You didn't see this?
C:
typedef struct
{
int _mp_alloc;        /* Number of *limbs* allocated and pointed
to by the _mp_d field.  */
int _mp_size;            /* abs(_mp_size) is the number of limbs the
last field points to.  If _mp_size is
negative this is a negative number.  */
mp_limb_t *_mp_d;        /* Pointer to the limbs.  */
} __mpz_struct;
The data will be in dynamically allocated memory pointed to by mp_d

Tom.G