The ModulaTor logo 7KB

The ModulaTor

Oberon-2 and Modula-2 Technical Publication

Erlangen's First Independent Modula_2 Journal! Nr. 11/Dec-1991

CRY: Cryptification Tool written in Oberon

by Günter Dotzel, ModulaWare

CRY is a symetrical cypher & decypher module with a key up-to 32 characters (256 Bit). CRY reads a file, cyphers it and writes it to the output file. To decypher a file encoded with CRY, apply CRY with the previously generated output file together with the matching key (password). Both, textual and binary files can be processed. The encoded files are always binary (8 bit bytes). The input file and the output files have equal size.

In most cases a file is encrypted to protect privacy when storing files or sending them over an electronic network. Usually files are compressed to save transfer-time, but it is also more difficult to decrypt a file which was compressed before encryption.

If the file to be encrypted should be stored (or transfered) in compressed form, it is recommended to first compress, then encrypt and store (or send) the file, because compressing encrypted files yields bad compression rates. At the destination, the receiver first decrypts the file with the same password as used for encryption and then decompresses the file.

The cryptification algorithm used is not guaranteed to be unbreakable. Use full-length passwords for the keystring. Note that with n = LENGTH (keystring), it may be possible to evaluate the keystring and decypher a file if the first n characters of the plain-text, i.e. unencrypted-text are known.

Don't ask me if you forgot your key!

For those who port CRY to another compiler or platform, the statements in the comment right at the start of the module body show, whether the en-/decoding of module Crypt is symetrical.

These statements set the cryptification key, encrypt a vector in the buffer twice, test the buffer and call HALT in the case that the input vector can't be restored.

The Oberon-2 module CRY uses the ISO Modula-2 I/O library.


__________________________________________________________________________________________________ 
MODULE CRY;
(* Cryptor module in Oberon-2.

  (C) 1991-1997 by Guenter Dotzel, ModulaWare
*)
IMPORT Crypt, SYSTEM, SeqFile, STextIO, TextIO, IOChan, ProgramArgs;

CONST maxbuff = 32000;
VAR X: Crypt.CRYPT;
  key: ARRAY 33 OF CHAR;
  i: INTEGER;

CONST maxfname = 254;
TYPE  Fname = ARRAY maxfname+1 OF CHAR;
VAR fn, ofn: Fname;
  returned: LONGINT;
  inp, out : SeqFile.ChanId;
  Buff: ARRAY maxbuff OF INTEGER;
  ores: SeqFile.OpenResults;

PROCEDURE Err(s:ARRAY OF CHAR);
BEGIN
  STextIO.WriteString(s); STextIO.WriteLn;
  HALT(20);
END Err;

PROCEDURE GetName(VAR name: ARRAY OF CHAR);
VAR err: BOOLEAN;
BEGIN (* get command line parameters *)
  IF ProgramArgs.IsArgPresent() THEN 
    TextIO.ReadToken(ProgramArgs.ArgChan(), name);
  ELSE Err("usage: $CRY inputFile outputFile keyString [0..31]");
  END;
END GetName;

BEGIN
  key:="01234567890123456789012345678901";
  (* self test Crypt:
    Crypt.SetKey(key,X); 
    FOR i:=0 TO maxbuff-1 DO Buff[i]:=i; END;
    Crypt.EnCryptBlock (X, Buff, maxbuff);
    Crypt.SetKey(key,X); 
    Crypt.EnCryptBlock (X, Buff, maxbuff);
    FOR i:=0 TO maxbuff-1 DO ASSERT(Buff[i]=i, 99); END;
  *)
  GetName(fn); GetName(ofn); GetName(key);
  Crypt.SetKey(key,X); 
  IF fn[0] # 0X THEN
    SeqFile.OpenRead(inp, fn, SeqFile.read + SeqFile.raw, ores); 
    IF ores # SeqFile.opened THEN Err("Cannot open input file") ;
    ELSE
      SeqFile.OpenWrite(out, ofn, SeqFile.write + SeqFile.raw, ores);
      IF ores # SeqFile.opened THEN Err("Cannot create output file") ;
      ELSE
        LOOP
          IOChan.RawRead(inp, SYSTEM.ADR(Buff), maxbuff*SIZE(INTEGER), returned);
          IF returned > 0  THEN 
            Crypt.EnCryptBlock (X, Buff, SHORT((returned+1) DIV SIZE(INTEGER)));
            IOChan.RawWrite(out, SYSTEM.ADR(Buff), returned);
          ELSE EXIT
          END;
        END;
        SeqFile.Close(out);
      END;
      SeqFile.Close(inp)
    END;
  END;
END CRY.

__________________________________________________________________________________________________ 

MODULE Crypt;
(* Revision history:
  KM/ModulaWare Nov-1983: Modula-2 version.
  GD/03-Jul-1997: transpiled to Oberon-2.

  Copyright (C) 1983-1997 by Guenter Dotzel, www.ModulaWare.com

*)
  IMPORT SYSTEM;

  CONST grad = 16;
  TYPE CRYPT* = RECORD
      x: ARRAY grad OF SET; 
      pos: INTEGER; 
    END;
    polynom = ARRAY grad OF SET;
  VAR c: polynom;

  PROCEDURE Random (VAR C: CRYPT): SET;
  VAR r: SET; i, posi: INTEGER;
  BEGIN
    r := {}; posi := C.pos; i := 0;
    WHILE i<grad DO (* compute next value *)
      r := r / (c[i] * C.x[(posi) MOD grad]);
      INC(posi); INC(i);
    END;
    C.x[C.pos] := r; (* feedback *)
    C.pos := (C.pos+1) MOD grad;
    RETURN r;
  END Random;

  PROCEDURE SetKey* (VAR key: ARRAY OF CHAR; VAR C: CRYPT);
  VAR i: INTEGER; contr: SET;
  BEGIN 
    contr := {}; C.pos := 0;
    FOR i := 0 TO grad-1 DO
      IF (i >= LEN(key) DIV 2) THEN C.x[i] := {0..15};
      ELSE C.x[i] := SYSTEM.VAL(SET, ORD(key[i*2])+256*ORD(key[i*2+1]));
      END;
      contr := contr + C.x[i];
      ASSERT(C.x[i] # {});
    END;
    contr := {0..15} - contr; C.x[0] := C.x[0] + contr;
  END SetKey;

  PROCEDURE EnCryptW* (VAR C: CRYPT; VAR w: INTEGER);
  BEGIN
    w := SYSTEM.VAL(INTEGER, Random(C)/(SYSTEM.VAL(SET,w)));
  END EnCryptW;

  PROCEDURE EnCryptBlock* (VAR C: CRYPT;
    VAR st: ARRAY OF INTEGER; len: INTEGER);
  VAR i,s: LONGINT;
  BEGIN
    i:=0;
    WHILE i<len DO
      s := st[i];
      st[i] := SYSTEM.VAL(INTEGER,(SYSTEM.VAL(SET,s))/Random(C));
      INC(i);
    END;
  END EnCryptBlock;

BEGIN (* preset of feedback polynome *)
  c[0] := SYSTEM.VAL(SET, 05F71H);
  c[1] := SYSTEM.VAL(SET, 02788H);
  c[2] := SYSTEM.VAL(SET, 0A0C6H);
  c[3] := SYSTEM.VAL(SET, 02711H);
  c[4] := SYSTEM.VAL(SET, 00986H);
  c[5] := SYSTEM.VAL(SET, 01006H);
  c[6] := SYSTEM.VAL(SET, 0DC28H);
  c[7] := SYSTEM.VAL(SET, 03406H);
  c[8] := SYSTEM.VAL(SET, 00804H);
  c[9] := SYSTEM.VAL(SET, 005C2H);
 c[10] := SYSTEM.VAL(SET, 002B0H);
 c[11] := SYSTEM.VAL(SET, 00100H);
 c[12] := SYSTEM.VAL(SET, 000C0H);
 c[13] := SYSTEM.VAL(SET, 00030H);
 c[14] := SYSTEM.VAL(SET, 0000DH);
 c[15] := SYSTEM.VAL(SET, 00003H);
END Crypt.
__________________________________________________________________________________________________ 

The ModulaTor Forum

Letters to the Editor

The article on the Ackermann Function, by Guenter Dotzel appeared in The ModulaTor, 03/91. It was also published under the title "A Function to end all functions", in Algorithm, 10/91.

Dear Editor,

I thoroughly enjoyed your article. But you too can compute A(4,2), on your PC. I am sending you a copy of my program VPCalc. Load the program and type


    SetMax(20,000)
    20,000 M
    Ax4y2 = 2^(2^(2^(2^2))) - 3
    WriteN("Ax4y2")
and A(4,2) will be computed and written to the file Ax4y2.VPN. The commands are not case sensitive and the commas (,) are not needed in numbers. The "Ax4y2 =" is better since it is stored inside the output file.

It takes about 29 seconds for VPCalc to compute A(4,2) on a 33 MHz 486DX machine. I have stored the value of A(4,2) that I computed and a program, Ackerman.Pas, I wrote to compute A(x,y) in files on the disk enclosed.

If you inspect the output file Ax4y2.VPN, it looks like:

Ax4y2 = m.n E+19728, m.n =2.00352 99304 06846 46497 90723 51560 25575 04478 25475 5697514192 65016 97371 08940 59556 31145 30895 06130 88093 3348101038 23434 29072 63181 82294 93821 18812 66886 95063 6476154702 91650 41871 91635 15879 66347 21944 29309 27982 0843091048 55990 57015 93189 59639 52486 33723 67203 00291 6969592156 10876 49488 89254 09080 59114 57037 67520 85002 06671 56370 23661 26359 74714 48071 11774 81588 09141 35742 7209671901 51836 28256 06180 91458 85269 98261 41425 03012 3391108273 6038 4 37678 76449 04320 59603 79124 49090 57075 6031403507 61625 62476 03186 37931 26484 70374 37829 54975 6137709816 04614 41330 86921 18102 48595 91523 80195 33103 0292162800 16056 86701 05651 64675 05680 38741 52946 38422 4484529253 73614 42533 61437 37290 88303 79460 12747 24958 4148649159 30647 25201 51556 93922 62818 06916 50796 38106 4132275307 26714 39981 58508 81129 26289 01134 23778 27055 67421 08007 00652 83963 32215 50778 31214 28855 16755 54073 3451072131 12427 39956 29827 19769 15005 48839 05223 80435 7045848197 95639 31578 53510 01899 20000 24141 96370 68135 5984046403 94721 94016 06951 76901 56119 72698 23378 90017 6415171900 51133 46630 68981 40219 38348 14354 26387 30653 9552969691 38802 41581 61859 56110 06403 62119 79610 18595 3480278716 72001 22604 64249 23851 11393 40046 43516 23867 5670787452 59464 67090 38865 47743 48321 78970 12764 45552 9409092021 95958 57516 22973 33357 61595 52394 88529 75799 5402847194 35299 13543 76370 59869 28913 75715 37400 01986 3943324648 90052 54310 66296 691 65 24341 91746 91389 63247 6560289415 19977 54777 03138 06478 13423 09596 19096 06545 9130089018 88875 88084 73362 59560 65444 88850 14473 35706 0588170901 62108 49971 45295 68344 06197 96905 65469 81363 1162053579 36979 14032 36328 49623 30464 21066 13620 02201 7578785185 74091 62050 48971 17818 20400 18728 29399 43446 1862243280 09837 32376 49318 14789 84811 94527 13007 44022 0765680910 37620 39992 03492 02390 66262 64491 90916 79854 6151577883 90603 97720 75927 93788 52241 29430 10174 58086 8622633692 84725 85140 30396 15558 56433 03854 50688 65221 3114813638 40838 47782 63790 45960 71868 76728 50976 34712 7198889068 04782 43230 39471 86505 25660 97815 07298 61141 4303058169 27924 97140 91610 59417 18535 22758 87504 47759 2218301158 78070 19755 35722 24140 00195 48102 00566 17735 8978149953 23252 08589 75346 35470 07786 69040 64290 16763 8081617405 50405 11767 00936 73202 80454 93390 27992 49186 7306539931 64072 04922 38474 81528 06191 66900 93380 57321 2081635070 76343 51669 86962 50209 69023 16285 93 500 71874 1905791612 41536 89751 48082 61904 84794 65717 36601 00589 2476655445 84083 83347 90544 14481 76842 55327 20731 55863 4934760513 74197 79525 19036 50321 98020 10876 47383 68682 5310251833 77533 90886 14261 84800 37400 80822 38104 07646 8878471647 55294 53269 47661 70042 44610 63311 23802 11345 8869453220 01165 64076 32702 30742 92426 05158 28110 70387 0183453245 67635 62595 14300 32037 43274 07808 79056 28366 3406965030 84422 58559 67039 27186 94611 58513 79338 64756 9974856867 00798 23960 60439 34788 50861 64926 03049 45061 7434123658 28352 14480 67266 76841 80708 37548 62211 40823 6579802961 20002 74413 24438 43240 23312 57403 54501 93524 2877643088 02328 50855 88608 99627 74458 16468 08578 75115 8070147437 63867 97695 50499 91643 99828 43572 90415 37814 3438847303 48426 19033 88841 49403 13661 39854 25763 55771 0533558020 66221 85577 06008 25512 88893 33222 64362 81984 8386132395 70676 19140 96385 33832 37434 37588 30859 23372 2284644287 99624 56054 76932 42899 84326 52677 37837 31732 8806321 075 32112 38680 60467 47084 28051 16648 87090 84770 2912081611 04912 55559 83223 66244 86855 66514 02684 64120 9694982590 56551 92161 88104 34122 68389 96283 07165 48685 2553691485 02995 39675 50395 49383 71853 40590 00961 87489 4739928804 32496 37316 57538 03673 58671 01757 83994 81847 1798498246 94806 05320 81996 06618 34340 12476 09663 95197 7802144119 97525 46704 08060 84993 44178 25628 50927 26523 7098986515 39462 19300 46073 64507 92621 29759 17698 29389 2367015170 99209 15315 67814 43979 12484 7570 6 23780 46000 0991829332 13068 80570 04659 14583 87208 08801 68874 45835 5579262584 65124 76308 71485 66313 52893 41661 17490 61752 6671492672 17612 83308 45273 93646 92445 82892 57138 88778 3905630048 24837 99839 69202 92222 15486 14590 23734 78222 6825216399 57440 80172 71441 46179 55922 61750 83889 02007 4169926238 30028 22862 49284 18267 12434 05751 42418 85699 9427233160 69987 12986 88277 18206 17214 45314 25749 44015 0661394631 69197 62918 15065 79745 52623 61912 24848 06389 0033669074 36598 92263 4 9564 11466 55030 62965 96019 97206 3620260352 19177 76740 66877 74635 49375 31889 95878 66282 1254697971 02065 74723 27213 72918 14466 66594 21872 00347 4508942830 91153 51892 71114 28710 83761 59222 38027 66053 2782335166 15551 49369 37577 84666 70145 71797 19012 27117 8127804502 40026 38475 87883 39396 81796 29506 90798 81712 1690686929 53824 85298 30023 47606 84541 14178 13911 06485 6023654975 42274 97231 00761 51318 70024 05391 05109 13817 8437217914 22528 58743 20985 24957 87803 46837 03337 81842 144 4017138 68812 42499 84418 61812 92711 98533 31538 25673 2187042153 06311 97748 53521 46709 55334 62633 66108 64667 3322924098 79849 25669 11095 16143 61860 15489 09740 24191 3509623043 61219 61281 65950 51866 60220 30715 61368 47323 6466086890 50142 63913 90651 50639 08199 37885 23183 65059 8972991254 04479 44342 51667 74299 65981 18492 33151 55527 2883274028 35268 84424 08752 81128 32899 80625 91267 36995 4624734154 33335 00147 23143 06127 50390 30739 71352 52069 3381738433 22950 70104 90618 67539 43313 07847 98015 65513 0384758155 68523 62180 10419 65025 55961 81934 98631 59132 3303609646 19059 90236 11268 11960 23441 84336 33345 94927 6319461017 16652 91382 37171 82394 29921 62725 38461 77606 5694542297 87707 13831 98817 03696 45886 89811 86321 09769 0035573588 46244 64835 70629 14530 52757 10127 88720 27965 3644797240 25405 44813 27483 91794 12882 64238 35171 94919 7209797145 93688 75371 98729 13083 17380 33911 01612 85474 1537737771 59517 28084 11162 75971 86384 92422 28023 73441 9254699919 83672 192 13 12870 35585 30796 69427 13416 39103 3882754318 61364 34901 00943 19740 90473 31014 47629 98617 2542442335 56122 37435 71582 59333 82804 98624 38924 98222 7807159517 62757 84710 94751 19033 48224 14120 25182 68871 3728193104 25347 81961 28440 17647 95315 05057 11072 29743 1456991522 34516 43121 84865 75757 86528 19756 48435 08958 3847229235 34559 46452 12158 31657 75147 12987 08225 90929 2655638836 65112 06819 43836 90411 62526 68710 04456 02437 0420066370 90019 41185 55716 04720 44643 69693 28500 60046 9281405071 19069 26139 39939 02735 53454 55674 70314 90388 6022024639 94826 05017 62431 96930 56406 66366 62609 02070 4888743889 89074 98152 86544 43818 62917 38290 10518 20869 9363826618 68303 91527 32645 81286 78280 66013 37500 09659 3364625146 09172 31803 12930 34787 74212 34679 11845 47913 1110989779 46482 16922 50562 93999 56793 48380 16991 57439 7005375421 34485 87458 68560 47286 75106 54233 41893 83909 9110586465 59511 36460 61055 15683 85412 17459 80180 71331 6361257307 96111 68343 86376 76673 07 354 58349 47897 88316 3301292408 00836 35682 59391 57113 13097 80305 16441 71668 2518346573 67593 41980 84958 94794 09832 92500 08638 97785 6349469321 24734 26103 06271 37450 77286 15692 25966 28573 8579055332 40641 84901 84513 28284 63270 92697 53830 86730 8409142247 65947 44399 73348 13081 09863 99417 37978 96570 1068702673 41619 67196 59159 95885 37834 82298 82701 25605 8423655895 39690 30647 49655 84147 98131 09971 57542 04325 6395776070 48510 08815 78291 40825 07777 38559 79012 91294 0730946278 59445 05859 41227 31948 12753 22515 23248 01503 4665190482 28961 40664 68903 05102 51091 62377 70448 48623 0229488966 71138 05556 07956 62073 24493 73374 02783 67673 0020301161 52270 08921 84351 56521 21379 21574 82068 59356 9207902145 02277 13309 99877 29459 59695 28170 44582 18195 6080965811 70279 80626 69891 20506 15607 42325 68684 22713 0629500986 44218 53470 81040 71289 17646 90655 08361 29916 6947780238 22502 78966 78434 89199 40965 73617 04586 78624 2554006942 51669 39792 92624 71452 49454 08858 42272 6 1537 5526007190 43363 29196 37577 75021 76005 19580 06938 47635 7895868784 89536 87212 28985 57806 82651 81927 03632 09948 0155874455 57517 53127 36471 42129 55364 94084 38558 66152 0801211507 90750 68553 34448 92586 93283 85965 30132 72046 9706945715 46959 35365 85717 88894 86233 32924 65202 73585 3188533370 94845 54033 36565 35698 81725 82528 91805 66354 8836374379 33484 11845 58016 83318 27676 83464 62919 95605 5134700391 47876 80864 03226 29616 64156 06675 08153 71064 6723108461 96424 75374 90553 7448 0 53182 26002 71021 64009 8058449752 60230 35640 03808 34720 53149 94117 29657 36785 0664214008 42696 49710 32419 19182 12121 32069 39769 14392 3368374709 22826 77387 08132 23668 00869 24703 49158 68409 9115309831 54120 63566 12318 75043 05467 53698 32308 27966 4574176208 06593 17726 56858 41681 83796 61061 44963 43254 4111706941 70022 26578 17358 35125 98210 80769 10196 10522 2926387974 50490 19254 31190 06205 61906 57745 24161 91913 1875339840 49343 97682 33102 98465 89331 83730 15809 59252 2829206820 8 6223 03325 85280 11926 64963 14441 31644 27730 0323779227 47123 30696 41714 99455 32261 03547 51456 31290 6688543454 26869 78844 77429 81777 49371 01176 14651 62418 3616680254 81529 63353 08490 84994 30067 63654 80610 29400 9469375060 98455 88558 04397 04859 14449 58444 50799 78497 0455835506 85408 74516 33164 64118 08312 30797 04389 84919 0506587586 42581 07384 22420 59119 19416 74182 49045 27002 8826398305 79500 57341 71148 70311 87142 83418 44991 53456 7029152801 04485 14517 60553 06971 44176 13685 823 84 10278 7659324662 68997 84183 19620 31226 24211 77391 47720 80048 8357833356 92045 33935 95325 45648 97028 55858 97355 05751 2351295365 40502 84208 10227 85248 77660 35742 46366 67314 8680279486 05244 57826 73626 23085 29782 65057 11462 48465 9591421027 81227 88941 44816 39949 73881 88462 27682 44851 6220518170 76722 16986 32657 01654 31691 97426 51230 04175 7329904473 53767 25368 45792 75436 54128 26553 58185 80468 4006936771 86050 20070 54724 75484 00805 53042 49518 54495 2672472613 47318 17474 21800 78574 69346 54471 36036 97588 4118029408 03961 67469 46288 54067 91721 38601 22541 95038 1970453841 72680 06398 82065 63287 92839 58270 85109 19958 8394482977 75647 15202 61328 71089 52616 34177 07151 64289 9487953564 85455 35531 48754 97813 40099 64854 49863 58248 4769059003 31169 61303 76612 79234 64323 12970 66284 11307 4270462020 32013 36835 03854 25360 31363 67635 75212 60470 7425311209 23340 28374 82949 45310 47274 18969 28727 55720 2761527226 82833 76741 39342 56526 53283 06846 99975 97097 75000556 08 89932 68502 50492 12884 06827 41398 81631 54045 6490350775 87168 00740 55685 72402 17586 85439 05322 81337 7070741583 07562 69628 31695 56874 24060 52772 64858 53050 6113563848 51965 91896 86495 96335 56821 69754 37621 43077 8665934730 45016 48224 32964 89127 07098 98076 67662 56715 1726906205 88155 49666 38257 38292 74182 08227 89606 84488 2229833948 16670 98403 90242 83514 30681 37672 53460 12600 7269262969 46867 27507 94346 19043 99966 18979 61192 87505 1944235640 26443 03271 73734 15912 81496 05616 83539 88188 5694840453 42311 42461 35599 25272 33006 48816 27466 72352 3751234311 89344 21188 85085 07935 81638 48994 48754 47563 3168921386 96755 74302 73795 37852 62542 32902 48810 47181 9390372206 66894 70220 42588 36895 84093 99984 53560 94886 9946833852 57967 51618 82159 41098 16249 18741 81336 47269 6512398067 75619 47912 55795 74464 71427 86862 40537 50576 1042042671 49366 08498 02382 74680 57598 25913 31006 91994 1904651906 53117 19089 26077 94911 92179 46407 35512 96338 6452303567 33455 88033 31 319 70803 65457 18479 15504 32654 8995597058 62888 28686 66066 18021 88224 86021 44999 97312 2164138170 65348 01755 10438 40662 44128 22803 61664 89042 5737764095 63264 82825 25840 76690 45608 43949 03252 90526 3375323165 09087 68133 66142 42398 30953 08065 49661 87938 1949120033 91948 94940 65132 39881 66420 80088 39555 49422 3709673484 00726 42705 70116 50890 75196 15537 01862 64797 4563811878 56175 45711 34004 73810 76276 30149 53309 73517 4180655479 11266 09380 34311 37853 25328 83533 35202 49343 6597 912934 12848 54970 94682 63290 75830 19307 26653 37782 5593143311 10963 84805 39408 59283 98890 77962 10479 84791 9686876539 98747 70959 12788 72747 58744 39806 77982 49682 7827220092 64499 44559 38041 46087 70641 94181 04407 58269 8056880389 49654 61658 79839 04660 58764 53418 10289 90719 4293021774 51997 61044 95043 19684 15034 55514 04482 09289 3337865736 30528 30619 99007 77487 26922 99860 82790 53171 6918765788 60908 94181 70579 93404 89021 84415 59791 09267 6862796597 58395 24839 26734 88363 47456 5 1687 01616 62406 4242424122 89611 18010 61568 23425 39392 18005 24834 54723 7792199112 28595 91419 18774 91793 82334 00100 78128 32650 6710281781 39602 91209 14720 10094 78787 52551 26337 28842 2235386949 00679 27664 51163 47581 01193 87531 96572 42121 4760382847 74774 57170 45786 10417 38574 79113 01908 58387 7890152334 34301 30052 82797 03858 03598 15182 92960 03056 8261209195 09437 37325 45417 10563 83887 04752 89505 63961 0298436413 60935 64163 25894 08137 98151 16933 38619 79733 9821670761 00460 7980 0 96016 02482 30969 43043 80695 66201 2321365014 05495 86250 61528 25880 33022 90838 58124 78469 3157203232 33601 89946 94376 47726 72187 93768 26431 82838 2603564520 69946 86302 16048 87452 84243 63593 55862 23335 0623594500 28905 58581 61127 53417 83750 45593 61261 30852 6408280512 13873 17749 02002 49552 73873 45859 56405 16083 0583053770 73253 39715 52620 44470 54295 73538 36111 36775 2316997274 02929 41674 20442 32481 13875 07563 13190 78272 1888640533 74694 21384 21699 28862 94047 96353 05150 56078 8126366206 49723 12575 79019 59887 30411 95626 22734 37289 0051656111 10941 11745 27796 54827 90471 25058 19990 77498 0638215593 76885 54649 88229 38985 40829 13251 29076 47838 6322494781 01675 34916 93489 28810 42030 15610 28338 61438 2737816094 63413 35383 57834 07653 14321 41715 06558 77547 8202524547 80657 30134 22774 70616 74424 19689 52613 16427 4104695474 62148 37562 88299 77180 41867 85084 54696 56191 5090869587 42511 84435 83730 65909 51460 98045 12474 09411 3738999278 22492 98336 77960 11015 387 09 61297 49705 56630 1637307202 75073 47599 22943 79239 38244 27421 18615 82361 6131788639 25530 95117 18842 12985 08307 23825 97291 44142 2515794038 83011 35908 33316 51858 23496 72212 59621 81250 7058113759 49552 50227 47274 67436 98871 31926 67076 92991 9908446716 12287 38858 45758 46227 26573 33075 37355 72823 9516169641 75198 67501 26817 45429 32373 82941 43824 81437 7139861906 71665 75729 45807 80482 05595 11881 68718 80752 1297183263 64421 55336 78775 12747 66940 79011 70575 09819 5750845635 65217 38954 41798 75074 52385 44552 00133 57203 3332379895 07439 39053 12918 21225 52598 33790 90946 36302 0218535384 88548 25062 89771 56169 63860 71238 27717 25621 3134605494 01770 41358 17319 31763 37013 63322 52819 12754 7191443450 92071 18488 38366 81817 42633 42949 61187 00915 0304916533 94647 63717 76643 91207 98347 49462 73978 22171 5020906701 90302 46976 21512 78521 95614 20708 06461 63137 3236517853 97629 20920 25500 28896 20129 70141 37964 00380 5573494926 90735 35145 96120 86747 96547 73369 29587 73 628 6356601437 67964 03843 07968 64138 56344 78013 28261 28458 9184898528 04804 88441 80821 63942 39740 14362 90348 16654 5811445436 64600 32490 61876 30395 02356 40204 45307 48210 2413668951 96644 22133 92007 57479 12868 38051 75150 63466 2569391937 74028 35120 75666 26082 98904 91877 28783 38521 7852279204 57718 46965 85527 87904 47562 19266 39920 08409 3020756739 25363 73562 83908 29817 57790 21532 02106 40961 7373283598 49406 66521 41198 18381 08845 15459 77289 51645 7213189779 79074 91941 01314 83685 44639 61690 46070 30107 5968189337 41217 57598 81651 27000 76126 27891 69510 40631 5857637534 78742 00702 22051 07089 12576 12361 65802 68068 1585849985 26314 65878 08661 68007 33264 67683 02063 91697 2030648944 05628 19540 61906 85242 00305 34631 56621 89132 7309069687 35318 16410 94514 28803 66059 95220 24824 88867 1155442910 47219 29134 24834 64387 05368 50864 87490 99178 8126705656 65387 19104 97218 20042 37149 27401 64460 94345 9845392536 70613 22106 16533 08566 20211 88968 23400 57526 7548610147 69 936 88738 20958 45522 11571 92347 96868 88160 8536316158 62880 15039 59494 18529 48922 70744 10828 20716 9303387818 08493 62040 18255 22227 10109 85653 44481 72074 7075601924 59155 99431 07294 95781 97878 59057 89400 52540 1228675171 42511 18435 64371 84053 56302 41812 25473 26609 3302710397 96809 10649 39272 72268 30354 10467 63259 13552 7968383770 50198 55234 62122 28584 10557 11992 17317 17969 8043393177 07750 75562 70560 47831 77984 44476 37560 25463 7033369247 11422 08155 19973 69137 19751 63241 3027 4 87121 9986340454 82485 24570 11855 33426 75264 71597 83107 31245 6634298052 21455 49415 62527 24028 91533 33543 49341 21786 2037007260 31527 98707 71872 49123 44944 77147 90952 07347 6138542548 53115 52773 30103 03424 76835 86549 60937 22324 0071545181 29732 69208 10584 24090 55772 56458 03681 46223 4493189708 13889 71432 99831 34761 77996 79712 45378 23107 0373915147 38786 92119 18756 67003 19321 28189 68033 22696 5944592862 10607 43882 74169 19465 16226 76325 40665 07088 1071030394 17886 05648 93769 8 1673 41590 25925 19461 18236 4294565266 93722 03155 50470 02135 98846 29275 80125 27715 4220166299 54863 13032 49123 11029 62792 37238 99766 41680 3497141226 52793 19076 36326 13681 41455 16376 65655 98397 8848938173 30826 68779 90196 28869 32296 59737 99519 31621 1872154552 87394 17024 36698 85593 88879 33167 44533 36311 9541518404 08828 38151 93421 23412 28200 30950 31334 10507 0476015998 79854 72529 19066 52224 79319 71544 03317 94836 8373732208 21885 77334 16238 56441 38070 05419 13530 24594 391350255 4 53188 64547 96252 26025 17629 28374 33046 51023 6105758351 45507 39443 33961 02162 29675 46141 57811 27197 0017386114 94279 50141 12532 80621 25477 58105 12972 08846 5263158094 80663 36876 70147 31073 35407 17710 87661 59358 5681409821 29677 30759 19738 29734 41445 25668 87708 55324 5708889583 20993 82343 21027 18224 11476 37327 91357 56861 5421252849 65790 33350 93152 77692 55058 45644 01055 21926 4450531207 37562 87744 99816 36463 32835 81614 03301 75813 9673594273 27690 44892 03618 80386 75495 57518 06890 05853 2927201493 92350 05258 45146 70698 26285 48257 88326 73987 3522045722 82392 90207 14482 22198 85587 10289 69919 35873 0742778151 59757 62076 40239 51243 86020 20325 96596 25021 2578349957 71008 56263 86118 23381 33185 09014 68657 70640 1067627861 75837 72772 89589 27460 39403 93033 72718 73850 5369129571 26715 06689 66884 93880 88514 29436 09962 01296 6759079225 08227 53138 12849 85152 69029 31700 26313 63289 4209579757 79593 27635 53116 20667 53488 65131 73238 72438 7480635133 14512 64488 996 75 89828 81292 54800 76425 18658 6490241111 12730 13571 97181 38160 25831 78506 93224 40079 9865663537 15440 88454 86639 31817 08395 73578 07990 59730 8390948818 04060 93595 91909 07473 96090 44101 50516 32174 9681412100 76571 91774 83767 35575 10007 33616 92238 65374 2907945780 32000 42337 45280 75661 53042 92901 44957 80629 6341383835 51783 59976 47088 51349 00485 69736 97965 23869 5845994595 59209 07090 58956 89145 11414 12684 50546 21179 4502661175 01669 28260 25095 07707 78211 95043 26173 83223 56243 76017 76799 36279 60993 68975 19139 49650 33358 50715 5418436456 85261 66742 43688 92037 10374 95328 42592 71316 1053783498 07407 39158 63381 79676 58425 25803 67372 06469 3512486522 38481 34166 38080 61505 70482 90598 90696 45193 6440018597 12042 57230 07316 41000 99169 87524 26037 73621 7776343062 16167 44884 93081 09299 01009 51797 45415 64251 2048220867 14586 84925 51324 44266 77712 78637 28211 33153 6224301091 82439 12433 80214 04624 22233 49153 55951 68908 1628848798 99882 73630 44537 24321 74280 21 575 57779 67021 6663170479 69728 17248 33928 41015 64227 45072 71779 26939 9929740308 07277 03950 13581 54514 24940 49026 53610 58254 0937311465 31049 43382 48437 97186 06937 21444 46008 26798 0024712294 89405 76185 38922 03425 60830 26970 52876 62137 7373594394 22411 47070 74072 90272 54613 07358 54174 56914 1944648762 43576 82397 06570 31841 68467 54073 34663 46293 6739836200 04041 40071 40542 77632 48013 27422 02685 39369 8869787607 00959 00486 84650 62677 13630 70979 82100 65572 8510130660 10107 80633 74334 47730 73478 65388 17426 81230 7437660666 43312 77535 64665 78603 71519 29227 68440 45827 3283243808 21284 12187 76132 04246 04649 00801 05473 14267 4926082692 21556 37405 48624 17170 31027 91999 69426 45620 9556198164 54547 66204 50224 11449 40474 93498 32206 80719 1352767986 74781 34582 03859 57041 34661 77937 22853 49400 3163159954 40936 84089 57253 34387 02986 71782 97703 73332 8068017646 39502 09002 39419 31499 11500 91052 76821 11951 0999063166 15031 15855 82835 58260 71794 10052 52858 36113 6 996130344 27901 73811 78741 20612 88182 06202 32638 49861 5156564512 30047 79296 75636 18345 76810 50433 41769 54306 7538041113 92855 37925 29241 34733 94810 50532 02570 87281 8630729115 89113 35942 01476 18726 64291 56403 63719 27602 3062838406 50425 44174 23354 64549 98705 53187 26887 92642 4102147363 69862 54637 47159 74435 49434 43899 73005 17425 2511087735 78863 90946 81209 66734 28152 58591 99248 57640 4880550713 29814 29935 99114 63239 91911 39599 26752 57635 9007446572 81019 18058 41807 34222 7734 7 21397 72321 82317 7171691640 01088 26112 54909 33611 86780 57572 23910 18186 1685491085 00885 27227 43742 12086 52485 23724 56248 69766 2245384819 29867 11294 52945 51549 70305 85919 30719 84971 0541418163 69689 76131 12674 40270 09648 66754 59345 67059 9369954645 00558 92162 80479 76365 68613 33165 63907 39570 3272034389 17541 52675 00915 01119 88568 72708 84819 55316 7693168127 28921 43031 37681 80164 45477 36751 83534 97857 9242764633 54162 43360 11259 60252 10950 16122 64110 34608 3465648235 59793 4 2740 56868 84922 44587 45493 77675 21203 2470380303 54911 57544 83129 52758 91939 89368 08763 27685 4387695576 94881 42284 43119 98595 70072 75213 93176 83783 1770339130 42306 09589 99137 31468 45690 10422 09516 19670 7050642025 67338 73446 11565 52761 75992 72715 18776 60010 2389447605 39789 51694 57088 02728 73622 51210 76224 09181 0066700883 47473 76051 56285 53394 35658 43756 27124 12444 5765166306 40859 39507 94755 09204 63932 24520 25354 63634 4447917556 61725 96218 71992 79186 57549 08578 52950 012 84 0229035061 51493 73101 07009 44615 10116 13712 42376 14267 2254173205 59592 02782 12932 57259 47146 41722 49773 21316 3818453265 55279 60427 05418 71496 23658 52524 58648 93325 4145062642 33788 56514 64670 60429 85647 81968 46159 36632 8895429978 07225 42264 79040 06160 19751 97500 74605 45150 0602918066 38271 49701 61109 87951 33663 37713 78434 41619 4053121445 29185 51801 36575 55866 76150 19373 02969 19320 7612000925 50650 81583 27550 84993 40768 79725 23699 87023 5679310268 04136 74571 89566 41431 85267 90547 17169 96299 0363015545 64509 00448 02789 05570 19683 28313 63071 89976 9915316667 92089 58768 57229 06009 15472 91963 63816 73596 6739599757 10326 01557 19202 37348 58052 11281 17458 61006 5152598883 84311 45118 94880 55212 91457 75699 14657 75300 4138471712 45779 65048 17585 63950 72895 33753 97558 22087 7775060723 39445 58789 59057 19156 733E+19728

From this you can see that A(4,2) has 19,729 decimal digits, not 19,728 as you stated in your article, a minor flaw.

Using my program Ackerman.PAS, it was easy to determine that:


    A(0,y) = y+1
    A(1,y) = y+2
    A(2,y) = 2y +3
    A(3,y) = 2^(y+3) -3
The formula for A(3,y) published in your article was "2 raised to the power of 2y+3", a typographical error.

From your article I deduced:


    A(4,y) = 2^(2^(2^...2)) -3, where there are y+2 2's
My program Ackerman.PAS also computes the total number of times that the A(x,y) function is called for an initial x,y. It would appear that the number of times called, AC(x,y), grows even faster than the Ackermann function itself. For example:

    A(3,6) =  509 and AC(3,6) = 172,233
    A(3,7) = 1021 and AC(3,7) = 693,964
    A(3,8) = 2045 and AC(3,8) = 2,785,999
Update May-2005:

My new programs XPCalc (Extra Precision Floating-Point Calculator) and XICalc (Extra Precision Integer Calculator) are distributed under GNU General Public License (GPL) can be downloaded, including all source code and documentation, from http://www.geocities.com/hjsmithh/Calc/index.html.

-Harry


Dear Harry,

It still holds true, that a computer can't compute Ackermann(4,2) using it's definition (i.e. the recursive algorithm). As you did, one has to analyse the function and construct an alternative algorithm.

Did you try Ackermann (4,3)?

Guenter


Dear Editor,

I agree that the Ackermann function is "A function to end all functions." You asked if I tried A(4,3). Well yes, but my program VPCalc only handles a value up to about 10^15,032,385,525 and can only handle 114,639 decimal digits in the mantissa. A(4,2) fits my niche well, but A(4,3) is way out there. It would take more than A(4,2) seconds to compute A(4,3) and the computer would need more than A(4,2) bits of memory. This cannot be done in this universe. Remember A(4,2) = 2.00352...E+19728.

Harry


IMPRESSUM: The ModulaTor is an unrefereed journal. Technical papers are to be taken as working papers and personal rather than organizational statements. Items are printed at the discretion of the Editor based upon his judgement on the interest and relevancy to the readership. Letters, announcements, and other items of professional interest are selected on the same basis.


Home Site_index Contact Legal Buy_products OpenVMS_compiler Alpha_Oberon_System ModulaTor Bibliography Oberon[-2]_links Modula-2_links

Amazon.com [3KB] [Any browser]


Webdesign by www.otolo.com/webworx, 21-Nov-1998, revised 09-May-2005