Algomath-Library   Beta-Release 0.93   4.1998
----------------   -----------------   -------

  You are free to do anything you desire with this code,
  as long as you give credit where credit is due...

  For criticism, fixes, suggestions, enhancements, send email to:

  Armand Turpel: armandt@unforgettable.com

  alternatively you may contact dragon@programmer.net ( who helped in optimizing this library )


  The Algomath-library provides a handful of mathematical algorithms in " C ".

  The library is tested with DJGPP v2 C-compiler although it should work on any other system;
  if all else fails, the source still remains :-) .

  Download the latest release at: http://www.geocities.com/CapeCanaveral/Hangar/7291/

INDEX
-----
     1.FILES IN THIS ARCHIVE
     2.SHORT DESCRIPTION
     3.LONGER DESCRIPTION
     4.HISTORY
     5.LEGAL AND OTHER STUFF

FILES IN THIS ARCHIVE:
----------------------

  algomath.c    library source code
  algomath.h    headerfile
  Makefile      DJGPP makefile
  libalgo.a     pentium precompiled algomath-library ( coff object format for use with DJGPP )
  Readme.txt    this file
  test.c        test-program, source
  test.exe      test-program


SHORT DESCRIPTION:
------------------

  int am_sumdigits(int n);
  int am_sumdigitsalt(int n);
  int am_rotate(int n, int x);
  int am_sumdivisors(int n);
  int am_sortdigits(int n);
  int am_primetest(int n);
  int am_gcd(int a, int b);
  void am_primearray (int p, n, int* Array );
  void am_factorize(int n, int* Array);
  int am_goldbach(int a,int *p)

LONGER DESCRIPTION:
-------------------

  int am_sumdigits(int n)

     returns the sum of the digits of the number n
     e.g. am_sumdigits( 5732 ) returns 17

  int am_sumdigitsalt(int n)

     returns the alternating sum of the digits of the number n
     even digits are substracted, odd digits are added
     e.g. am_sumdigitsalt( 5732 ) returns -1

  int am_rotate(int n,int x)

     rotates the digits of a number n, x times, in base 10
     e.g. am_rotate( 12345,  3) returns 45123 ( rotate right if x > 0 )
          am_rotate( 12345, -3) returns 34512 ( rotate left  if x < 0 )

  int am_sumdivisor(int n)

     returns the sum of all possible divisors of the number n, n not included
	 e.g. am_sumdivisors( 20 ) returns 22 ( = 1 + 2 + 4 + 5 + 10 )

  int am_sort( int n)

     " sorts " the digits of a number n
     e.g. am_sort( 57834 ) returns 34578

  int am_primetest(int n)

     returns 1 if n is prime else -1

  int am_gcd(int a, int b)

     returns the " greatest common divisor " of two numbers a and b
	 e.g. am_gcd( 123698745, 147896325) returns 45

  void am_primearray(int p, int n, int* array)

     stores prime numbers to an array ( allocate first :-),
     n prime numbers beginning at the p'th prime number
     e.g.: am_primearray(10000, 30000, int* array)
     stores in array[] 30000 prime numbers beginning at the 10000th prime

  void am_factorize(int n, int* array)

     facrorizes a number n and stores its factors in array[]
     were array[0] contains the number of factors found
     and the following indexes contain the factors
	 e.g. am_factorize( 20 ) returns array[0] = 3, array[1] = 2, array[2] = 2, array[3] = 5

  int am_goldbach(int a,int *p)
     "--Goldbach's Conjecture
        The Conjecture is, "Every even integer greater than 2 is the sum of
        two primes."--"
     Return -1 if fails else 1.
     a is the even integer.
     *p is the array (allocate first) were contains the two primenumber
     where the first p[0] is the smallest possible.

HISTORY:
--------
  Algomath 0.9 beta  first release 12.1997
           0.91 beta bugfix release 3.1998
           0.92 beta bugfix release 3.1998
           0.93 beta reviewed and add int am_goldbach(int a,int *p) 4.1998

LEGAL AND OTHER STUFF:
----------------------

  Pentium is a (registered) trademark of Intel, http://www.intel.com
  DJGPP is the MSDOS-port of the famous GNU-C compiler, http://www.delorie.com
  MSDOS is a (registered) trademark of Microsoft, http://www.microsoft.com
  for info on GNU software see http://www.gnu.org


------------------------------------------------------------------------------
  Luxembourg, 4.1998,
  Armand Turpel
