Johann N. Löfflmann • computer scientist

Welcome to my private homepage • computer scientific subjects and more

BigAl  2.4.0

Screenshot showing BigAl on Puppy Linux running in VMware Player

The screenshot above shows BigAl 2.4.0 in action on Puppy Linux 2.16.1 running in VMware Player for a time consuming "stop and continue" calculation.


BigAl is a syntetic word made of "Big Algorithms". With BigAl you can calculate really BIG numbers with an accuracy your desktop calculator is still dreaming of. The only restriction is the power of your computer!

Not only basic calculations are supported, but also special functions like factorial, fibonacci, lucas-sequence, periods, fraction reducing, square root, nth root, generation of random numbers, sum of the digits, binomial coefficient calculation, factorize function, bit oriented functions and many more. BigAl is able to handle numbers stored in files since Version 1.0. BigAl can also be used to simulate a high load on your computer.

BigAl is a free and open source software. BigAl is written entirely in Java, it runs on any platform that has a Java Runtime Environment. BigAl uses the Java classes called BigInteger and BigDecimal.

Here are some examples and a short description of the usage to demonstrate the program. 


BigAl v2.4.0 Copyright © 2001-2012  Dipl.-Inf. (FH) Johann Nepomuk Löfflmann
For release notes click here.
 OSI Certified
This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2 of the License, or any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License for more details. See also FAQ.


Get Java Software

In order to run BigAl, you need a Java Runtime Environment (JRE). You can get it for free. It is required to have at least the JRE version 1.4.2, but it is recommended to install JRE 6 or later.


Read the Copyright. You have to read and accept the GNU General Public Licence if you want to use BigAl.
DownloadDownload BigAl (version 2.4.0, June 23, 2007)

Filesize:    116 KB
MD5:         bf5f47a68d76609945f7ffb82ff6af22
SHA1:        4b379fcd57fc42dea4db6012d67e4c4818945f9e
SHA256:      603a1a406cf88faf355d22b0fb74ee0f1ced7970eabf120eb2e7766dd2b67503

DownloadDownload BigAl on Puppy Linux on VMware
(BigAl 2.4.0 installed with JRE 6u1 on Puppy Linux 2.16.1 installed on a VMware image, June 30, 2007;
useful if you want to perform stop-and-continue calculations and your host operating system is Linux or Windows)

Filesize:    94 MB
MD5:         9d8fc46533fc19cc99e03f67102ca26c
SHA1:        d448156b8d33d36e1d048e3b579983e13e7bc994
SHA256:      b14d6e9990c791c2198f7734a7b27e126b7a1eb07e026089fd3a4dfb049f24eb

DownloadDownload BigAl on Puppy Linux in a VirtualBox
(BigAl 2.4.0 installed with JRE 6u4 on Puppy Linux 3.01 installed in a VirtualBox image, February 23, 2008;
useful if you want to perform stop-and-continue calculations and your host operating system is Linux, Windows, Mac OS X or Solaris)

Filesize:    118 MB
MD5:         8464b55ef0afb5477f1252f0783b792c
SHA1:        aba57d0f54feed4ac82466fb014efedd04760431
SHA256:      e23ae1a748a5502d9873138c6a9ec3a0ed3fe778695904524a596e5b86583a9d

Acknowledgement: Barry Kauler is the original developer and current maintainer of Puppy Linux (
Note: Install instructions on How to Install Puppy Linux on VMware und How to Install Puppy Linux in a Virtualbox are available.

To verify the MD5 and the SHA digests, you can use the free program called Jacksum.
Read the readme.txt, stored in the file zip file to get useful information how to install the program on your computer.


Trackers (Bug database, Support and Feature requests):


Without any parameters you get this info
% bigal

 BigAl v2.4.0, Copyright (C) 2001-2007, Dipl.-Inf. (FH) Johann N. Loefflmann

 BigAl comes with ABSOLUTELY NO WARRANTY; for details see 'license.txt'.
 This is free software, and you are welcome to redistribute it under certain
 conditions; see 'license.txt' for details.
 Visit for the latest version.

 For more information please type:
 java BigAl help

 Fuer weitere Informationen bitte eingeben:
 java BigAl hilfe

Put the parameter "help" and you get a full description how the program can be used:

% bigal help

    BigAl (Big Algorithms)


    java -classpath bigal.jar BigAl [parameters]...
    java -jar bigal.jar [parameters]...

    BigAl is both a free open source software and a platform independent
    utility for computing really big numbers. BigAl is written entirely
    in Java. A Java Runtime Environment (JRE) is required.

    The following parameters are supported:

    [help|-h] | <number|file|[std]in> <op> <number|file|[std]in> [?[?]]

    help     this help
    -h       this help
    number   A and B are unlimited floating point variables respectively
             unlimited integers (see also FUNCTIONS); a, b and c are limited
    file     ASCII file containing a number
    op       operation, see also FUNCTIONS
    stdin    read from the standard input device
    in       read from the standard input device
    ?        print the required duration of the function in ms
    ??       print the required duration of the function in format

    A and B are unlimited decimal variables
    number  operation      number  description
    A       add|+          B       addition
    A       sub|-          B       subtraction
    A       mul|*|x        B       multiplication
    A       div|/|:        B       division (exact, as fraction)
    A       divide|//|::   B       division (exact, period is marked by ~),
    A       divide|//|::   B x     division (rounded, x digits after the point)

    A       eq             B       equals?
    A       gt             B       greater than?
    A       ge             B       greater or equals?
    A       lt             B       less than?
    A       le             B       less or equals?

    A       abs|absolute           returns |A|
    A       neg|negate             returns -A
    A       nop                    returns A, standard format (no operation)
    A       round          x       rounded A, x digits after the dec. point
    A       sgn|signum             returns the signum of A
    A       sci            [x]     returns A, scientific formatting (exact),
                                   with x significant figures (optional)

    A       pow|^          N       power(A,N)
    A       rt|root        n x root of A, x digits after the point
    A       sqrt           x       squareroot of A, x digits after the point

    A and B are unlimited integer variables
    number  operation      number  description
    A       base           b       A in a base b numeral system
    A       tobase         b       A to a base b numeral system

    a       ack            B       ack(a,B) [Ackermann function]
    A      even                   is A an even number?
    A       fac|!          [B C]   factorial(A) [predefined factorial(B):=C]
    A       factorize              factorize A by using the Pollard-Rho method
    A       fib|fibonacci  [b c]   fibonacci(A) [with different init values]
    A       gcd|ggt        B       greatest common divisor
    A       len|length             number of digits of A 
    A       lcm|kgv        B       least common multiple
    A       luc|lucas              lucas(A)
    A       mod|%          B       modulo
    A       nk|choose      B       A choose B (binomial coefficient)
    A       odd                    is A an odd number?
    A       random         B [n]   n positive random numbers in [A..B]
    a       randdigits     b [n]   n positive random number with [a..b] digits
    A       sod                    sum of the digits

    Bit oriented, A and B are unlimited integer variables
    number  operation      number  description
    A       gbit|getbit    b       returns the bit at pos b, pos 0 is right
    A       sbit|setbit    b       sets the bit at pos b, pos 0 is right
    A       fbit|flipbit   b       flips the bit at position b
    A       cbit|clearbit  b       sets the bit at position b to 0

    A       and            B       bit oriented AND
    A       or             B       bit oriented OR
    A       xor            B       bit oriented XOR
    A       not                    bit oriented NOT

    A       bcnt|bitcount          number of bits that differ from its sign bit
    A       blen|bitlength         number of bits excluding a sign bit


    Program arguments              description 
    1 + 9999999999999999999999999  simple addition
    VeryBigNumber.txt sub 6        subtraction with file-content
    in mul 5                       multiplication by using 'standard in'
    1.23456e3 nop                  returns 1234.56
    1234.56 sci                    returns 1.23456e3
    1234.56 eq 1.23456e3           returns true
    1 / 1234.56                    result of division (exakt) as fraction
    1 // 1234.56                   result of division (exakt) with period
    1 divide 1234.56               result of division (exakt) with period
    1 divide 1234.56 10            result of division (rounded), scale 10
    2 sqrt 100                     square root of 2, scale 100
    1.728 root 3 12                3rd root of 1.728, scale 12
    77 pow 10000 "?"               power-function, duration as ms
    in fac                         factorial of n by entering n
    10000 fac 4 24                 factorial of 10000, use 4!:=24
    100 fac | java BigAl in pow 6  working with 'in', (100!)^6
    123 fib                        123th number in Fibonacci-sequence
    123 fib "??"                   fibonacci, duration as d, h, m, s, ms
    123 fib 2 1                    different seed 2 and 1 => Lucas-sequence
    123 luc                        123th number in Lucas-sequence
    282361 factorize               factorize the number 282361
    big.txt length                 length of number in big.txt
    1234567890 mod 12345           modulo
    60 gcd 24                      greatest common divisor
    1820 lcm 6825                  least common multiplier
    0123456789 sod                 sum of the digits
    number.txt getbit 0            odd or even number?
    49 nk 6                        binomial coefficient (49 choose 6)
    3 ack 5                        ackermann function ack(3,5)
    1 random 6 10                  10 random numbers from 1 to 6
    2 randdigits 6 1000            1000 random numbers, each with 2 to 6 digits
    42 tobase 2                    convert 42 to base 2
    101010 base 2                  101010 in base 2
    help | more                    prints the english help

    Copyright (C) 2001-2007, Dipl.-Inf. (FH) Johann N. Loefflmann,

    This program is free software; you can redistribute it and/or modify
    it under the terms of the GNU General Public License as published by
    the Free Software Foundation; either version 2 of the License, or any
    later version.

    This program is distributed in the hope that it will be useful,
    but WITHOUT ANY WARRANTY; without even the implied warranty of
    GNU General Public License for more details.

    You should have received a copy of the GNU General Public License
    along with this program; if not, write to the Free Software
    Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA


Q: What does the $ mean?

A:  It is a standard GNU/Linux resp. Unix convention to use $ in order to represent the command prompt (as known as "shell"). If you see that sign, type everything behind it. It is also a standard convention on Microsoft Windows to use C:\> in order to represent the Windows command prompt. When you see a "prompt", type everything behind it.

Q: I get an error message by typing
$ bigal 3 * 4
invalid operation

A: Usually, shells expands special characters like * to a filelist. Use the text operators (e. g. "mul") or mark it as a special character:

% bigal 3 \* 4
% bigal 3 "*" 4
C:\> java BigAl 3 "*" 4
C:\> java BigAl 3 mul 4
C:\> java BigAl 3 x 4

Q: Can I reduce a fraction?

A: Yes, you can. Use the operation "div" alias "/".

$ bigal 15 / 145

Q: Can I process the output of a division further with BigAl?

A: Yes, but you need to generate a normal decimal number rather than a fraction.

$ bigal 15 // 145 10

Q: Is there a graphical user interface for BigAl ?

A: No. BigAl's purpose is to calculate with absolutely accuracy and it prefers to calculate with really big numbers. Those tasks are often very time consuming and it's possible that you don't get the result in a few seconds or minutes. It could take hours, days, weeks, month or even years until BigAl returns the result. Therefore, the commandline interface is the primary interface for BigAl. Let BigAl working in the background, redirect the output to files and do further processing with numbers stored in files.

Well, of course BigAl will help you also by solving simple tasks, but only at the command line.

Q: What purpose have the VMware image, respectively the VirtualBox?

A: The VMware Player respectively the VirtualBox are able to save the state of a Virtual Machine (VM). For the VMware Player select "Player -> Exit". For the VirtualBox select "Machine -> Close... -> Save the machine state". In order to restore the VM simply start the VM again.

As soon as the VM state has been restored, BigAl continues with the calculation. BigAl won't even recognize that there was a pause. Repeat the procedure as often as needed.

With this trick you can perform calculation tasks which take longer than only a few seconds or minutes. You can perform calculations which could take hours, days, months or even years if required, because you can interrupt a calculation at any time and you can continue a calculation whenever you want. You can even continue a calculation on a different computer!

Detailed descriptions can be found in the readme files which are included in the .zip file. Go to the download section. Do you want to see a screenshot?

Q: Can I use complex expressions with brackets?

A: No. Basically, only the simple expression <number> <operation> <number> is supported. But you can process the output of BigAl further with standard-input, pipes and files.

Q: Why is the following syntax not possible?
java -jar bigal.jar x + y > x

A: Your shell (or your command line interpreter) does not allow to do write to a file while you want to read from it. In other words, you cannot use the a file as output if it is part of one of the operators. What you can do is this:

java -jar bigal.jar x + y > z

Q: I cannot enter very long numbers on the command line, what's wrong?

A: Your shell (or your command line interpreter) has a limit in accepting long strings, use a different shell (I recommend the bash on Linux/Unix) or store numbers in files. Numbers in files can be handled very well by BigAl.

Q: I get the error message called 'Exception in thread "main" java.lang.OutOfMemoryError: Java heap space'

A: The calculation you would like to perform requires more memory. You can increase the maximum heap space for the Java process with the option -Xmx. Example:

java -Xmx128m -jar bigal.jar

If you use a 64 bit operating system, please make sure to have also a 64 bit Java Runtime Environment if you want to specify more than 4 GB for the Java Heap (in real life, more than 2,5 GB resp. 3 GB, dependent on the operating system).


Task: 999999999999999999999999999999 + 6
$ bigal 999999999999999999999999999999 + 6

If you would like to know how this number is called in words, use the NumericalChameleon.

Task: 123456789.987654321 * 987654321.123456789

$ bigal 123456789.987654321 * 987654321.123456789 =

Task: 4261655511456885005249781170177

$ bigal 4261655511456885005249781170177 div 34
125342809160496617801464152064, 1/34

To evaluate also the rest (1/34), use the operators called "division" or "//" rather than "div" or "/":

$ bigal 4261655511456885005249781170177 division 34

The "~" marks the beginning of the period. That means, the result is exactly:

Task: What is the scientific representation of 12345.6789 ?

$ bigal 12345.6789 sci

=> the "scientific function" (sci) formats a normal number (12345.6789) to a scientific representation (1.23456789 * 104)

Task: What does the representation -12.34e-4 mean?

$ bigal -12.34e-4 nop

=> the "no operation" (nop) formats a scientific representation (-12.34 * 10-4)  to a normal number representation (-0.001234).

Task: fibonacci(100)

$ bigal 100 fib

Task: 100!

$ bigal 100 fac

Note: the line break above (actually the number hasn't any line breaks) has been inserted by the terminal output.

Task: How long does it take to calculate 10000!

In this case, the result is unimportant, we redirect the output to "/dev/null" (use "nul" on Windows). It's saver to quote the question mark to avoid any replacements by your shell.

% bigal 10000 fac "?" > /dev/null

The duration of the operation above was 13450 milliseconds. If you want it in format "day, hours, minutes, seconds, milliseconds" use "??" rather than "?".

C:\> bigal 10000 fac "??" > nul
0 d, 0 h, 0 m, 13 s, 589 ms

Task: (100!)6

"in" or "stdin" are the names for BigAl's standard input channel. Use it with pipes ...

$ bigal 100 fac | java BigAl in pow 6

... or use numbers stored in files ...

$ bigal 100 fac > result.txt
$ bigal result.txt pow 6 > endresult.txt

The result of the task above is:


How many digits does the number have? Use the operation called "length" to get this info.

$ bigal endresult.txt length

The example (100!)6 results in a number having 948 digits.

Task: 2^2^3

That is the same as 2^8 and not 4^3. You must first calcualte the exponent and pass the result as being the next exponent. Use a pipe to pass the result to the next function.

$ bigal 2 pow 3 | bigal 2 pow in

Task: Factorize the number 44343535354351600000003434353

$ bigal 44343535354351600000003434353 factorize

=> 149 * 329569479697 * 903019357561501 = 44343535354351600000003434353
All three numbers are primes.

Task: x * y by entering x and y interactively

$ bigal in mul in

Task: Is 98 an odd or an even number?

$ bigal 98 getbit 0

Find out what bit 0 is (bit 0 is the least significant bit). The result 0 means that the number 98 is even.

$ bigal 98 even

Also the operator called "even", tells you that 98 is even.

Task: Get the parity of a number

$ bigal 98 bitcount | bigal stdin getbit 0

3 bits are set in 98 (1100010) and 3 is an odd number, because the least significant bit of it is 1. In other words 98 must be an even number.

How to calculate "the 9th root of the octal number 555760042152261557325705050700225 ?

I see, you want to know how old I am. :) Well, at first you must convert the octal number to a decimal number.

$ bigal 555760042152261557325705050700225 base 8 > decimal

Then, calcualte the 9th root of the result (with zero decimal places)

% bigal decimal rt 9 0


Please note that the following table is correct since Nov 8, 2001. There were some typos before that date. Many thanks to Eugene G. Hamilton for this important hint. Don't panic, BigAl's factorial function works correctly since version 1.0.0 - there were only silly typos in the table below and not in the program.

Here are the results from the factorial-function:

n factorial (n)
10 3.6288 *106
(most human brains give up here already, 
try it: 1*2*3*4*5*6*7*8*9*10 = 3628800)
70 1.197857166... * 10100
(most calculators fail here already)
100 9.332621544... * 10157
(this is already more than one gogool)
104 1.029901674... * 10166
(the calculator on the Apple iPhone 3GS (iOS 6) gives up at this stage)
171 1.241018070... * 10309
(a few Javascript based Online-Programs give up at this stage)
1000 4.023872600... * 102567
3249 6.412337688.. * 1010000
(the calculator from Windows 10 gives up at this stage with an overflow)
10000 2.846259680... *1035659
100000 2.824229407... *10456573
200000 1.420225345... *10973350
300000 1.477391531... *101512851
400000 2.534486046... *102067109
500000 1.022801584... *102632341
550000 6.073602851... *102918340
600000 2.234878177... *103206317
650000 3.750830256... *103496105
700000 6.491076229... *103787565
750000 2.646896442... *104080578
800000 5.684678740... *104375039
850000 1.383690070... *104670859
900000 3.990191093... *104967956
1000000 8.263931688... *105565708
(a really nice large number - you need more than 5.5 million digits to write the number down)
2000000 3.776821057... * 1011733474
(it's bigger, 11 million digits, 11 MB are required to store the number uncompressed)
3000000 9.038571657.... * 1018128483
(18.1 MB are required to store that number)
... ...

Release Notes

Version 2.4.0 (Jun 23, 2007):
- new operations
  o support for the square root (sqrt) (sf# 1388680)
  o support for the nth root (rt, root)
    Thanks to Ronald Mark for the free source code
  o support for converting a number from and to a numeral system
    (base, tobase)
- improved operations:
  o range and count parameters for the random function
  o No parameter limits for the fibonacci/lucas function anymore
  o No parameter limits for the factorial function anymore
  o No parameter limits for the power function anymore and
    performance improvement for power
  o No parameter limits for the nk/choose function anymore
- support for the free cacaojvm
- JRE 1.4.2 or later required
- installer for Windows, build with NSIS v2.28

Version 2.3.1 (Jan 29, 2006):
- bugs fixed:
  o since JRE 5.0 BigAl prints out scientific format in some cases, even if
    we don't want sci format. This change in BigDecimal's toString() method
    has been introduced by JSR 13. BigAl works around the documented
    incompatibility to keep compatibility with older JVMs.
  o ant script print warnings about non UTF-8 comments in sourcecode
    while compiling on Linux with UTF-8 locale
- performance improvement for ackermann({0-4},n)
- BigAl 2.3.1 has been successfully tested with the Java Runtime Environments
  gij 4.0.2, J2SE 1.3.1, J2SE 1.4.2, J2SE 5.0 and Java SE 6.0-rc-b69

Version 2.3.0 (30-Apr-2005):
- BigAl has been successfully tested with the Java Runtime Environments
  Kaffe 1.1.4, gij 3.2.2, J2SE 1.3.1, J2SE 1.4.2, J2SE 5.0 and J2SE 6.0-ea-b29
- bug fixed:
  o information about the time needed for an operation is wrong
    if the operation takes more than 24 hours. Thanks to
    Stéphane Ecochard, France for both the bug report and the fix
  o function divide throws OutOfMemoryException if dividend is negative
  o function divide drops all digits after the comma if divisor is negative
  o functions sod and len retrun wrong result if value is negative
- improved operations:
  o Much faster Fibonacci function, provided by Tobias Wahl, Germany
  o Floating point support for operations abs, add, div, divide, eq,
    gt, ge, lt, le, mul, negate, nop, round, sci, signum, sub
- new operations:
  o Factorize function (Pollard-Rho) from the Princeton University
  o Ackermann function provided by Tobias Braun, Germany
  o Random function to generate random numbers
  o Round function for rounding numbers
  o Sci function for formatting numbers in the scientific format
  o Signum and Negate function
  o Comparison functions eq, gt, ge, lt, le, odd and even
- Unix/Linux-script and Windows-batch for being able to start BigAl easier
- System.exit() has been avoided, so BigAl can be used in other projects easier
- documentation updated
- with Ant build.xml file for developers

Version 2.2.0 (23-Feb-2002):
- improved fibonacci
  (fixed an index problem, it is faster and can use different init values
  for the lucas sequence for example)
- the factorial function gives now also a result for 0!
- new operations: abs, nk (very fast binomial coefficient algorithm),
  luc (lucas sequence)
- language support for english and german
- improved timer
- using J2SDK 1.3.1
- jar package, all you need is one jar file

Version 2.1.0a (08-Nov-2001):
- fixed some typos in the HTML
- still 2.1.0

Version 2.1.0 (25-Mar-2001):
- updated documentation
- new operations: length, getbit, setbit, flipbit, clearbit,
  and, or, xor, not, bitcount, bitlength

Version 2.0.0 (11-Mar-2001):
- new operaion: nop (no operation)
- read values from standard input and from files
- duration of operations in ms and in d,h,m,s,ms on demand
- length of an operand on demand
- you can continue calculating factorial from a given value
- you can evaluate fractions with detailed period

Version 1.0.0 (25-Feb-2001):
- simple expression evaluation with unlimited numbers
- operations available: add, sub, mul, div, divide, mod, fib,
  fac, pow, gcd, lcm, sod