home *** CD-ROM | disk | FTP | other *** search
MacBinary | 1997-10-07 | 5.0 KB | [TEXT/MPS ] |
open in:
MacOS 8.1
|
Win98
|
DOS
browse contents |
view JSON data
|
view as text
This file was processed as: MacBinary
(archive/macBinary).
Confidence | Program | Detection | Match Type | Support
|
---|
1%
| dexvert
| MacBinary (archive/macBinary)
| fallback
| Supported |
1%
| dexvert
| Text File (text/txt)
| fallback
| Supported |
100%
| file
| MacBinary II, inited, Tue Oct 7 02:53:25 1997, modified Tue Oct 7 02:53:25 1997, creator 'MPS ', type ASCII, 4476 bytes "LongMath.c" , at 0x11fc 428 bytes resource
| default (weak)
| |
99%
| file
| data
| default
| |
74%
| TrID
| Macintosh plain text (MacBinary)
| default
| |
25%
| TrID
| MacBinary 2
| default (weak)
| |
100%
| dearkID
| deark: macbinary
| default
| |
100%
| lsar
| MacBinary
| default
| |
100%
| librempegprobeID
| NGC (Nintendo DSP Standard) (ngcdspstd)
| default (weak)
|
|
id metadata |
---|
key | value |
---|
macFileType | [TEXT] |
macFileCreator | [MPS ] |
hex view+--------+-------------------------+-------------------------+--------+--------+
|00000000| 00 0a 4c 6f 6e 67 4d 61 | 74 68 2e 63 00 00 00 00 |..LongMa|th.c....|
|00000010| 00 00 00 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |........|........|
|00000020| 00 00 00 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |........|........|
|00000030| 00 00 00 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |........|........|
|00000040| 00 54 45 58 54 4d 50 53 | 20 01 00 00 00 00 00 00 |.TEXTMPS| .......|
|00000050| 00 00 00 00 00 11 7c 00 | 00 01 ac b0 5f 8c e5 b0 |......|.|...._...|
|00000060| 5f 8c e5 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |_.......|........|
|00000070| 00 00 00 00 00 00 00 00 | 00 00 81 81 ab aa 00 00 |........|........|
|00000080| 2f 2a 20 09 73 6f 6d 65 | 20 6c 6f 6e 67 20 69 6e |/* .some| long in|
|00000090| 74 65 67 65 72 20 6d 61 | 74 68 20 72 6f 75 74 69 |teger ma|th routi|
|000000a0| 6e 65 73 0d 09 43 6f 70 | 79 72 69 67 68 74 20 28 |nes..Cop|yright (|
|000000b0| 63 29 20 31 39 39 37 20 | 62 79 20 4a 6f 68 6e 20 |c) 1997 |by John |
|000000c0| 4d 6f 6e 74 62 72 69 61 | 6e 64 2e 20 20 41 6c 6c |Montbria|nd. All|
|000000d0| 20 52 69 67 68 74 73 20 | 52 65 73 65 72 76 65 64 | Rights |Reserved|
|000000e0| 2e 0d 09 50 65 72 6d 69 | 73 73 69 6f 6e 20 67 72 |...Permi|ssion gr|
|000000f0| 61 6e 74 65 64 20 66 6f | 72 20 70 75 62 6c 69 63 |anted fo|r public|
|00000100| 20 75 73 65 2e 0d 09 44 | 69 73 74 72 69 62 75 74 | use...D|istribut|
|00000110| 65 20 66 72 65 65 6c 79 | 20 69 6e 20 61 72 65 61 |e freely| in area|
|00000120| 73 20 77 68 65 72 65 20 | 74 68 65 20 6c 61 77 73 |s where |the laws|
|00000130| 20 6f 66 20 63 6f 70 79 | 72 69 67 68 74 20 61 70 | of copy|right ap|
|00000140| 70 6c 79 2e 0d 09 55 53 | 45 20 41 54 20 59 4f 55 |ply...US|E AT YOU|
|00000150| 52 20 4f 57 4e 20 52 49 | 53 4b 2e 0d 09 44 4f 20 |R OWN RI|SK...DO |
|00000160| 4e 4f 54 20 44 49 53 54 | 52 49 42 55 54 45 20 4d |NOT DIST|RIBUTE M|
|00000170| 4f 44 49 46 49 45 44 20 | 43 4f 50 49 45 53 2e 0d |ODIFIED |COPIES..|
|00000180| 09 43 6f 6d 6d 65 6e 74 | 73 2f 71 75 65 73 74 69 |.Comment|s/questi|
|00000190| 6f 6e 73 2f 70 6f 73 74 | 63 61 72 64 73 20 74 6f |ons/post|cards to|
|000001a0| 20 74 68 65 20 61 75 74 | 68 6f 72 20 61 74 20 74 | the aut|hor at t|
|000001b0| 68 65 20 61 64 64 72 65 | 73 73 3a 0d 09 09 4a 6f |he addre|ss:...Jo|
|000001c0| 68 6e 20 4d 6f 6e 74 62 | 72 69 61 6e 64 0d 09 09 |hn Montb|riand...|
|000001d0| 50 2e 4f 2e 20 42 6f 78 | 2e 20 31 31 33 33 0d 09 |P.O. Box|. 1133..|
|000001e0| 09 53 61 73 6b 61 74 6f | 6f 6e 20 53 61 73 6b 61 |.Saskato|on Saska|
|000001f0| 74 63 68 65 77 61 6e 20 | 43 61 6e 61 64 61 0d 09 |tchewan |Canada..|
|00000200| 09 53 37 4b 20 33 4e 32 | 0d 09 6f 72 20 62 79 20 |.S7K 3N2|..or by |
|00000210| 65 6d 61 69 6c 20 61 74 | 3a 0d 09 09 74 69 6e 79 |email at|:...tiny|
|00000220| 6a 6f 68 6e 40 73 6b 2e | 73 79 6d 70 61 74 69 63 |john@sk.|sympatic|
|00000230| 6f 2e 63 61 0d 09 49 66 | 20 79 6f 75 20 77 6f 75 |o.ca..If| you wou|
|00000240| 6c 64 20 6c 69 6b 65 20 | 74 6f 20 68 61 76 65 3a |ld like |to have:|
|00000250| 0d 09 09 74 65 63 68 6e | 69 63 61 6c 20 73 75 70 |...techn|ical sup|
|00000260| 70 6f 72 74 20 72 65 67 | 61 72 64 69 6e 67 20 74 |port reg|arding t|
|00000270| 68 69 73 20 66 69 6c 65 | 2c 20 73 65 6e 64 20 61 |his file|, send a|
|00000280| 20 70 6f 73 74 63 61 72 | 64 2e 0d 09 73 65 65 20 | postcar|d...see |
|00000290| 61 6c 73 6f 3a 0d 09 09 | 68 74 74 70 3a 2f 2f 77 |also:...|http://w|
|000002a0| 77 77 33 2e 73 6b 2e 73 | 79 6d 70 61 74 69 63 6f |ww3.sk.s|ympatico|
|000002b0| 2e 63 61 2f 74 69 6e 79 | 6a 6f 68 6e 0d 2a 2f 0d |.ca/tiny|john.*/.|
|000002c0| 23 69 6e 63 6c 75 64 65 | 20 22 4c 6f 6e 67 4d 61 |#include| "LongMa|
|000002d0| 74 68 2e 68 22 0d 23 69 | 6e 63 6c 75 64 65 20 3c |th.h".#i|nclude <|
|000002e0| 54 79 70 65 73 2e 68 3e | 0d 23 69 6e 63 6c 75 64 |Types.h>|.#includ|
|000002f0| 65 20 3c 51 75 69 63 6b | 44 72 61 77 2e 68 3e 0d |e <Quick|Draw.h>.|
|00000300| 0d 6c 6f 6e 67 20 46 61 | 63 74 6f 72 69 61 6c 28 |.long Fa|ctorial(|
|00000310| 6c 6f 6e 67 20 6e 29 20 | 7b 0d 09 69 66 20 28 6e |long n) |{..if (n|
|00000320| 20 3d 3d 20 30 29 0d 09 | 09 72 65 74 75 72 6e 20 | == 0)..|.return |
|00000330| 31 3b 0d 09 65 6c 73 65 | 20 7b 0d 09 09 6c 6f 6e |1;..else| {...lon|
|00000340| 67 20 66 61 63 74 3b 0d | 09 09 66 6f 72 20 28 66 |g fact;.|..for (f|
|00000350| 61 63 74 20 3d 20 31 3b | 20 6e 20 3e 20 30 3b 20 |act = 1;| n > 0; |
|00000360| 6e 2d 2d 29 20 66 61 63 | 74 20 2a 3d 20 6e 3b 0d |n--) fac|t *= n;.|
|00000370| 09 09 72 65 74 75 72 6e | 20 66 61 63 74 3b 0d 09 |..return| fact;..|
|00000380| 7d 0d 7d 0d 0d 6c 6f 6e | 67 20 46 69 62 6f 6e 61 |}.}..lon|g Fibona|
|00000390| 63 63 69 28 6c 6f 6e 67 | 20 6e 29 20 7b 0d 09 6c |cci(long| n) {..l|
|000003a0| 6f 6e 67 20 6e 30 20 3d | 20 31 2c 20 6e 31 20 3d |ong n0 =| 1, n1 =|
|000003b0| 20 31 2c 20 69 2c 20 66 | 69 62 20 3d 20 31 3b 0d | 1, i, f|ib = 1;.|
|000003c0| 09 69 66 20 28 6e 20 3d | 3d 20 30 20 7c 7c 20 6e |.if (n =|= 0 || n|
|000003d0| 20 3d 3d 20 31 29 0d 09 | 09 72 65 74 75 72 6e 20 | == 1)..|.return |
|000003e0| 31 3b 0d 09 65 6c 73 65 | 20 7b 0d 09 09 66 6f 72 |1;..else| {...for|
|000003f0| 20 28 69 3d 32 3b 20 69 | 3c 3d 6e 3b 20 69 2b 2b | (i=2; i|<=n; i++|
|00000400| 29 20 7b 0d 09 09 09 66 | 69 62 20 3d 20 6e 30 20 |) {....f|ib = n0 |
|00000410| 2b 20 6e 31 3b 0d 09 09 | 09 6e 30 20 3d 20 6e 31 |+ n1;...|.n0 = n1|
|00000420| 3b 0d 09 09 09 6e 31 20 | 3d 20 66 69 62 3b 0d 09 |;....n1 |= fib;..|
|00000430| 09 7d 0d 09 09 72 65 74 | 75 72 6e 20 66 69 62 3b |.}...ret|urn fib;|
|00000440| 0d 09 7d 0d 7d 0d 0d 6c | 6f 6e 67 20 47 72 65 61 |..}.}..l|ong Grea|
|00000450| 74 65 73 74 43 6f 6d 6d | 6f 6e 44 69 76 69 73 6f |testComm|onDiviso|
|00000460| 72 28 6c 6f 6e 67 20 6d | 2c 20 6c 6f 6e 67 20 6e |r(long m|, long n|
|00000470| 29 20 7b 0d 09 69 66 20 | 28 6e 20 3e 20 6d 29 0d |) {..if |(n > m).|
|00000480| 09 09 72 65 74 75 72 6e | 20 47 72 65 61 74 65 73 |..return| Greates|
|00000490| 74 43 6f 6d 6d 6f 6e 44 | 69 76 69 73 6f 72 28 6e |tCommonD|ivisor(n|
|000004a0| 2c 20 6d 29 3b 0d 09 65 | 6c 73 65 20 69 66 20 28 |, m);..e|lse if (|
|000004b0| 6e 20 3d 3d 20 30 29 0d | 09 09 72 65 74 75 72 6e |n == 0).|..return|
|000004c0| 20 6d 3b 0d 09 65 6c 73 | 65 20 72 65 74 75 72 6e | m;..els|e return|
|000004d0| 20 47 72 65 61 74 65 73 | 74 43 6f 6d 6d 6f 6e 44 | Greates|tCommonD|
|000004e0| 69 76 69 73 6f 72 28 6e | 2c 20 6d 20 25 20 6e 29 |ivisor(n|, m % n)|
|000004f0| 3b 0d 7d 0d 0d 0d 2f 2a | 20 6b 74 68 20 42 69 6e |;.}.../*| kth Bin|
|00000500| 6f 6d 69 61 6c 20 63 6f | 65 66 66 69 63 69 65 6e |omial co|efficien|
|00000510| 74 20 66 6f 72 20 28 78 | 20 2b 20 61 29 20 5e 20 |t for (x| + a) ^ |
|00000520| 6e 20 2a 2f 0d 6c 6f 6e | 67 20 42 69 6e 6f 6d 69 |n */.lon|g Binomi|
|00000530| 61 6c 43 6f 65 66 66 69 | 63 69 65 6e 74 28 6c 6f |alCoeffi|cient(lo|
|00000540| 6e 67 20 6e 2c 20 6c 6f | 6e 67 20 6b 29 20 7b 0d |ng n, lo|ng k) {.|
|00000550| 09 69 66 20 28 6b 20 3d | 3d 20 30 29 0d 09 09 72 |.if (k =|= 0)...r|
|00000560| 65 74 75 72 6e 20 31 3b | 0d 09 65 6c 73 65 20 72 |eturn 1;|..else r|
|00000570| 65 74 75 72 6e 20 28 20 | 46 61 63 74 6f 72 69 61 |eturn ( |Factoria|
|00000580| 6c 28 6e 29 20 2f 20 28 | 20 46 61 63 74 6f 72 69 |l(n) / (| Factori|
|00000590| 61 6c 28 6e 20 2d 20 6b | 29 20 2a 20 46 61 63 74 |al(n - k|) * Fact|
|000005a0| 6f 72 69 61 6c 28 6b 29 | 20 29 20 29 3b 0d 7d 0d |orial(k)| ) );.}.|
|000005b0| 0d 6c 6f 6e 67 20 50 65 | 72 6d 75 74 61 74 69 6f |.long Pe|rmutatio|
|000005c0| 6e 73 28 6c 6f 6e 67 20 | 6e 2c 20 6c 6f 6e 67 20 |ns(long |n, long |
|000005d0| 72 29 20 7b 0d 09 69 66 | 20 28 72 20 3d 3d 20 30 |r) {..if| (r == 0|
|000005e0| 29 0d 20 20 09 09 72 65 | 74 75 72 6e 20 31 3b 0d |). ..re|turn 1;.|
|000005f0| 09 65 6c 73 65 20 72 65 | 74 75 72 6e 20 28 46 61 |.else re|turn (Fa|
|00000600| 63 74 6f 72 69 61 6c 28 | 6e 29 20 2f 20 46 61 63 |ctorial(|n) / Fac|
|00000610| 74 6f 72 69 61 6c 28 6e | 20 2d 20 72 29 29 3b 0d |torial(n| - r));.|
|00000620| 7d 0d 0d 6c 6f 6e 67 20 | 43 6f 6d 62 69 6e 61 74 |}..long |Combinat|
|00000630| 69 6f 6e 73 28 6c 6f 6e | 67 20 6e 2c 20 6c 6f 6e |ions(lon|g n, lon|
|00000640| 67 20 72 29 20 7b 0d 09 | 72 65 74 75 72 6e 20 42 |g r) {..|return B|
|00000650| 69 6e 6f 6d 69 61 6c 43 | 6f 65 66 66 69 63 69 65 |inomialC|oefficie|
|00000660| 6e 74 28 6e 2c 20 72 29 | 3b 0d 7d 0d 0d 0d 76 6f |nt(n, r)|;.}...vo|
|00000670| 69 64 20 50 72 69 6d 65 | 46 61 63 74 6f 72 73 28 |id Prime|Factors(|
|00000680| 6c 6f 6e 67 20 6e 2c 20 | 6c 6f 6e 67 2a 20 63 6f |long n, |long* co|
|00000690| 75 6e 74 2c 20 6c 6f 6e | 67 20 2a 66 61 63 74 73 |unt, lon|g *facts|
|000006a0| 29 20 7b 0d 09 6c 6f 6e | 67 20 66 61 63 74 6f 72 |) {..lon|g factor|
|000006b0| 20 3d 20 32 3b 0d 09 69 | 66 20 28 6e 20 3d 3d 20 | = 2;..i|f (n == |
|000006c0| 31 29 20 7b 0d 09 09 2a | 66 61 63 74 73 20 3d 20 |1) {...*|facts = |
|000006d0| 31 3b 0d 09 09 2a 63 6f | 75 6e 74 20 3d 20 31 3b |1;...*co|unt = 1;|
|000006e0| 0d 09 7d 20 65 6c 73 65 | 20 7b 0d 09 09 2a 63 6f |..} else| {...*co|
|000006f0| 75 6e 74 20 3d 20 30 3b | 0d 09 09 77 68 69 6c 65 |unt = 0;|...while|
|00000700| 20 28 6e 20 3e 20 31 29 | 0d 09 09 09 69 66 20 28 | (n > 1)|....if (|
|00000710| 28 6e 20 25 20 66 61 63 | 74 6f 72 29 20 3d 3d 20 |(n % fac|tor) == |
|00000720| 30 29 20 7b 0d 09 09 09 | 09 2a 66 61 63 74 73 2b |0) {....|.*facts+|
|00000730| 2b 20 3d 20 66 61 63 74 | 6f 72 3b 0d 09 09 09 09 |+ = fact|or;.....|
|00000740| 2a 63 6f 75 6e 74 20 2b | 3d 20 31 3b 0d 09 09 09 |*count +|= 1;....|
|00000750| 09 6e 20 3d 20 28 6e 20 | 2f 20 66 61 63 74 6f 72 |.n = (n |/ factor|
|00000760| 29 3b 0d 09 09 09 7d 20 | 65 6c 73 65 20 66 61 63 |);....} |else fac|
|00000770| 74 6f 72 20 2b 3d 20 31 | 3b 0d 09 7d 0d 7d 0d 0d |tor += 1|;..}.}..|
|00000780| 6c 6f 6e 67 20 47 65 74 | 50 72 69 6d 65 46 61 63 |long Get|PrimeFac|
|00000790| 74 6f 72 73 28 6c 6f 6e | 67 20 76 61 6c 75 65 2c |tors(lon|g value,|
|000007a0| 20 6c 6f 6e 67 20 2a 63 | 6f 75 6e 74 2c 20 6c 6f | long *c|ount, lo|
|000007b0| 6e 67 20 2a 66 61 63 74 | 6f 72 73 29 20 7b 0d 09 |ng *fact|ors) {..|
|000007c0| 6c 6f 6e 67 20 6e 2c 20 | 6d 2c 20 6a 2c 20 66 61 |long n, |m, j, fa|
|000007d0| 63 74 73 3b 0d 09 42 6f | 6f 6c 65 61 6e 20 67 65 |cts;..Bo|olean ge|
|000007e0| 6e 65 72 61 74 69 6e 67 | 3b 0d 09 66 61 63 74 73 |nerating|;..facts|
|000007f0| 20 3d 20 30 3b 0d 09 69 | 66 20 28 66 61 63 74 73 | = 0;..i|f (facts|
|00000800| 20 3e 3d 20 2a 63 6f 75 | 6e 74 29 20 72 65 74 75 | >= *cou|nt) retu|
|00000810| 72 6e 20 66 61 63 74 73 | 3b 0d 09 6e 20 3d 20 76 |rn facts|;..n = v|
|00000820| 61 6c 75 65 3b 0d 09 6d | 20 3d 20 63 65 69 6c 28 |alue;..m| = ceil(|
|00000830| 73 71 72 74 28 6e 29 29 | 3b 0d 09 64 6f 20 7b 0d |sqrt(n))|;..do {.|
|00000840| 09 09 67 65 6e 65 72 61 | 74 69 6e 67 20 3d 20 66 |..genera|ting = f|
|00000850| 61 6c 73 65 3b 0d 09 09 | 66 6f 72 20 28 6a 3d 32 |alse;...|for (j=2|
|00000860| 3b 20 6a 20 3c 3d 20 6d | 3b 20 6a 20 3d 20 28 28 |; j <= m|; j = ((|
|00000870| 6a 3d 3d 32 29 3f 33 3a | 28 6a 2b 32 29 29 29 0d |j==2)?3:|(j+2))).|
|00000880| 09 09 09 69 66 20 28 28 | 6e 25 6a 29 3d 3d 30 29 |...if ((|n%j)==0)|
|00000890| 20 7b 0d 09 09 09 09 66 | 61 63 74 6f 72 73 5b 66 | {.....f|actors[f|
|000008a0| 61 63 74 73 2b 2b 5d 20 | 3d 20 6a 3b 0d 09 09 09 |acts++] |= j;....|
|000008b0| 09 69 66 20 28 66 61 63 | 74 73 20 3e 3d 20 2a 63 |.if (fac|ts >= *c|
|000008c0| 6f 75 6e 74 29 20 72 65 | 74 75 72 6e 20 66 61 63 |ount) re|turn fac|
|000008d0| 74 73 3b 0d 09 09 09 09 | 6e 20 3d 20 6e 2f 6a 3b |ts;.....|n = n/j;|
|000008e0| 0d 09 09 09 09 67 65 6e | 65 72 61 74 69 6e 67 20 |.....gen|erating |
|000008f0| 3d 20 74 72 75 65 3b 0d | 09 09 09 09 62 72 65 61 |= true;.|....brea|
|00000900| 6b 3b 0d 09 09 09 7d 0d | 09 7d 20 77 68 69 6c 65 |k;....}.|.} while|
|00000910| 20 28 67 65 6e 65 72 61 | 74 69 6e 67 29 3b 0d 09 | (genera|ting);..|
|00000920| 69 66 20 28 6e 20 21 3d | 20 31 29 20 66 61 63 74 |if (n !=| 1) fact|
|00000930| 6f 72 73 5b 66 61 63 74 | 73 2b 2b 5d 20 3d 20 6e |ors[fact|s++] = n|
|00000940| 3b 0d 09 2a 63 6f 75 6e | 74 20 3d 20 66 61 63 74 |;..*coun|t = fact|
|00000950| 73 3b 0d 09 72 65 74 75 | 72 6e 20 66 61 63 74 73 |s;..retu|rn facts|
|00000960| 3b 0d 7d 0d 0d 6c 6f 6e | 67 20 4c 65 61 73 74 43 |;.}..lon|g LeastC|
|00000970| 6f 6d 6d 6f 6e 4d 75 6c | 74 69 70 6c 65 28 6c 6f |ommonMul|tiple(lo|
|00000980| 6e 67 20 6d 2c 20 6c 6f | 6e 67 20 6e 29 20 7b 0d |ng m, lo|ng n) {.|
|00000990| 09 6c 6f 6e 67 20 6d 63 | 6f 75 6e 74 2c 20 6e 63 |.long mc|ount, nc|
|000009a0| 6f 75 6e 74 2c 20 6d 66 | 61 63 74 73 5b 33 32 5d |ount, mf|acts[32]|
|000009b0| 2c 20 6e 66 61 63 74 73 | 5b 33 32 5d 2c 20 66 61 |, nfacts|[32], fa|
|000009c0| 63 74 73 5b 36 34 5d 3b | 0d 09 6c 6f 6e 67 20 69 |cts[64];|..long i|
|000009d0| 2c 20 6a 2c 20 6b 3b 0d | 09 50 72 69 6d 65 46 61 |, j, k;.|.PrimeFa|
|000009e0| 63 74 6f 72 73 28 6d 2c | 20 26 6d 63 6f 75 6e 74 |ctors(m,| &mcount|
|000009f0| 2c 20 6d 66 61 63 74 73 | 29 3b 0d 09 50 72 69 6d |, mfacts|);..Prim|
|00000a00| 65 46 61 63 74 6f 72 73 | 28 6e 2c 20 26 6e 63 6f |eFactors|(n, &nco|
|00000a10| 75 6e 74 2c 20 6e 66 61 | 63 74 73 29 3b 0d 09 69 |unt, nfa|cts);..i|
|00000a20| 3d 6a 3d 6b 3d 30 3b 0d | 09 77 68 69 6c 65 20 28 |=j=k=0;.|.while (|
|00000a30| 69 3c 6d 63 6f 75 6e 74 | 20 26 26 20 6a 3c 6e 63 |i<mcount| && j<nc|
|00000a40| 6f 75 6e 74 29 0d 09 09 | 69 66 20 28 6d 66 61 63 |ount)...|if (mfac|
|00000a50| 74 73 5b 69 5d 20 3c 20 | 6e 66 61 63 74 73 5b 6a |ts[i] < |nfacts[j|
|00000a60| 5d 29 20 66 61 63 74 73 | 5b 6b 2b 2b 5d 20 3d 20 |]) facts|[k++] = |
|00000a70| 6d 66 61 63 74 73 5b 69 | 2b 2b 5d 3b 0d 09 09 65 |mfacts[i|++];...e|
|00000a80| 6c 73 65 20 69 66 20 28 | 6d 66 61 63 74 73 5b 69 |lse if (|mfacts[i|
|00000a90| 5d 20 3e 20 6e 66 61 63 | 74 73 5b 6a 5d 29 20 66 |] > nfac|ts[j]) f|
|00000aa0| 61 63 74 73 5b 6b 2b 2b | 5d 20 3d 20 6e 66 61 63 |acts[k++|] = nfac|
|00000ab0| 74 73 5b 6a 2b 2b 5d 3b | 0d 09 09 65 6c 73 65 20 |ts[j++];|...else |
|00000ac0| 7b 20 66 61 63 74 73 5b | 6b 2b 2b 5d 20 3d 20 6e |{ facts[|k++] = n|
|00000ad0| 66 61 63 74 73 5b 6a 2b | 2b 5d 3b 20 69 2b 2b 3b |facts[j+|+]; i++;|
|00000ae0| 20 7d 0d 09 77 68 69 6c | 65 20 28 69 3c 6d 63 6f | }..whil|e (i<mco|
|00000af0| 75 6e 74 29 20 66 61 63 | 74 73 5b 6b 2b 2b 5d 20 |unt) fac|ts[k++] |
|00000b00| 3d 20 6d 66 61 63 74 73 | 5b 69 2b 2b 5d 3b 0d 09 |= mfacts|[i++];..|
|00000b10| 77 68 69 6c 65 20 28 6a | 3c 6e 63 6f 75 6e 74 29 |while (j|<ncount)|
|00000b20| 20 66 61 63 74 73 5b 6b | 2b 2b 5d 20 3d 20 6e 66 | facts[k|++] = nf|
|00000b30| 61 63 74 73 5b 6a 2b 2b | 5d 3b 0d 09 66 6f 72 28 |acts[j++|];..for(|
|00000b40| 6a 3d 31 2c 20 69 3d 30 | 3b 20 69 3c 6b 3b 20 69 |j=1, i=0|; i<k; i|
|00000b50| 2b 2b 29 20 6a 20 2a 3d | 20 66 61 63 74 73 5b 69 |++) j *=| facts[i|
|00000b60| 5d 3b 0d 09 72 65 74 75 | 72 6e 20 6a 3b 0d 7d 0d |];..retu|rn j;.}.|
|00000b70| 0d 0d 0d 74 79 70 65 64 | 65 66 20 76 6f 69 64 20 |...typed|ef void |
|00000b80| 28 2a 50 65 72 6d 75 74 | 65 43 6f 6c 6c 65 63 74 |(*Permut|eCollect|
|00000b90| 6f 72 29 28 6c 6f 6e 67 | 2a 20 74 68 65 5f 6c 69 |or)(long|* the_li|
|00000ba0| 73 74 2c 20 6c 6f 6e 67 | 20 6c 69 73 74 5f 73 69 |st, long| list_si|
|00000bb0| 7a 65 2c 20 6c 6f 6e 67 | 20 70 61 72 61 6d 29 3b |ze, long| param);|
|00000bc0| 0d 0d 73 74 61 74 69 63 | 20 76 6f 69 64 20 72 6f |..static| void ro|
|00000bd0| 74 61 74 65 5f 6c 6f 6e | 67 73 5f 72 69 67 68 74 |tate_lon|gs_right|
|00000be0| 28 6c 6f 6e 67 2a 20 74 | 68 65 5f 6c 69 73 74 2c |(long* t|he_list,|
|00000bf0| 20 6c 6f 6e 67 20 6c 69 | 73 74 5f 73 69 7a 65 29 | long li|st_size)|
|00000c00| 20 7b 0d 09 72 65 67 69 | 73 74 65 72 20 6c 6f 6e | {..regi|ster lon|
|00000c10| 67 20 69 2c 20 6c 61 73 | 74 5f 65 6c 74 20 3d 20 |g i, las|t_elt = |
|00000c20| 74 68 65 5f 6c 69 73 74 | 5b 6c 69 73 74 5f 73 69 |the_list|[list_si|
|00000c30| 7a 65 2d 31 5d 3b 0d 09 | 72 65 67 69 73 74 65 72 |ze-1];..|register|
|00000c40| 20 6c 6f 6e 67 20 2a 73 | 72 63 20 3d 20 74 68 65 | long *s|rc = the|
|00000c50| 5f 6c 69 73 74 2b 28 6c | 69 73 74 5f 73 69 7a 65 |_list+(l|ist_size|
|00000c60| 2d 31 29 2c 20 2a 64 73 | 74 20 3d 20 74 68 65 5f |-1), *ds|t = the_|
|00000c70| 6c 69 73 74 2b 6c 69 73 | 74 5f 73 69 7a 65 3b 0d |list+lis|t_size;.|
|00000c80| 09 66 6f 72 20 28 69 3d | 30 3b 20 69 3c 28 6c 69 |.for (i=|0; i<(li|
|00000c90| 73 74 5f 73 69 7a 65 2d | 31 29 3b 20 69 2b 2b 29 |st_size-|1); i++)|
|00000ca0| 20 2a 2d 2d 64 73 74 20 | 3d 20 2a 2d 2d 73 72 63 | *--dst |= *--src|
|00000cb0| 3b 0d 09 74 68 65 5f 6c | 69 73 74 5b 30 5d 20 3d |;..the_l|ist[0] =|
|00000cc0| 20 6c 61 73 74 5f 65 6c | 74 3b 0d 7d 0d 0d 73 74 | last_el|t;.}..st|
|00000cd0| 61 74 69 63 20 76 6f 69 | 64 20 72 5f 70 65 72 6d |atic voi|d r_perm|
|00000ce0| 75 74 65 28 6c 6f 6e 67 | 2a 20 74 68 65 5f 6c 69 |ute(long|* the_li|
|00000cf0| 73 74 2c 20 6c 6f 6e 67 | 20 6c 69 73 74 5f 73 69 |st, long| list_si|
|00000d00| 7a 65 2c 20 6c 6f 6e 67 | 20 72 6f 74 61 74 69 6f |ze, long| rotatio|
|00000d10| 6e 5f 73 69 7a 65 2c 20 | 50 65 72 6d 75 74 65 43 |n_size, |PermuteC|
|00000d20| 6f 6c 6c 65 63 74 6f 72 | 20 63 6f 6c 6c 65 63 74 |ollector| collect|
|00000d30| 2c 20 6c 6f 6e 67 20 70 | 61 72 61 6d 29 20 7b 0d |, long p|aram) {.|
|00000d40| 09 69 66 20 28 72 6f 74 | 61 74 69 6f 6e 5f 73 69 |.if (rot|ation_si|
|00000d50| 7a 65 20 3d 3d 20 31 29 | 0d 09 09 63 6f 6c 6c 65 |ze == 1)|...colle|
|00000d60| 63 74 28 74 68 65 5f 6c | 69 73 74 2c 20 6c 69 73 |ct(the_l|ist, lis|
|00000d70| 74 5f 73 69 7a 65 2c 20 | 70 61 72 61 6d 29 3b 0d |t_size, |param);.|
|00000d80| 09 65 6c 73 65 20 7b 0d | 09 09 6c 6f 6e 67 20 69 |.else {.|..long i|
|00000d90| 3b 0d 09 09 66 6f 72 20 | 28 69 3d 30 3b 20 69 3c |;...for |(i=0; i<|
|00000da0| 72 6f 74 61 74 69 6f 6e | 5f 73 69 7a 65 3b 20 69 |rotation|_size; i|
|00000db0| 2b 2b 29 20 7b 0d 09 09 | 09 72 5f 70 65 72 6d 75 |++) {...|.r_permu|
|00000dc0| 74 65 28 74 68 65 5f 6c | 69 73 74 2c 20 6c 69 73 |te(the_l|ist, lis|
|00000dd0| 74 5f 73 69 7a 65 2c 20 | 72 6f 74 61 74 69 6f 6e |t_size, |rotation|
|00000de0| 5f 73 69 7a 65 2d 31 2c | 20 63 6f 6c 6c 65 63 74 |_size-1,| collect|
|00000df0| 2c 20 70 61 72 61 6d 29 | 3b 0d 09 09 09 72 6f 74 |, param)|;....rot|
|00000e00| 61 74 65 5f 6c 6f 6e 67 | 73 5f 72 69 67 68 74 28 |ate_long|s_right(|
|00000e10| 74 68 65 5f 6c 69 73 74 | 2c 20 72 6f 74 61 74 69 |the_list|, rotati|
|00000e20| 6f 6e 5f 73 69 7a 65 29 | 3b 0d 09 09 7d 0d 09 7d |on_size)|;...}..}|
|00000e30| 0d 7d 0d 0d 76 6f 69 64 | 20 50 65 72 6d 75 74 65 |.}..void| Permute|
|00000e40| 28 6c 6f 6e 67 2a 20 74 | 68 65 5f 6c 69 73 74 2c |(long* t|he_list,|
|00000e50| 20 6c 6f 6e 67 20 6c 69 | 73 74 5f 73 69 7a 65 2c | long li|st_size,|
|00000e60| 20 50 65 72 6d 75 74 65 | 43 6f 6c 6c 65 63 74 6f | Permute|Collecto|
|00000e70| 72 20 63 6f 6c 6c 65 63 | 74 2c 20 6c 6f 6e 67 20 |r collec|t, long |
|00000e80| 70 61 72 61 6d 29 20 7b | 0d 09 69 66 20 28 6c 69 |param) {|..if (li|
|00000e90| 73 74 5f 73 69 7a 65 20 | 3e 20 30 29 0d 09 09 72 |st_size |> 0)...r|
|00000ea0| 5f 70 65 72 6d 75 74 65 | 28 74 68 65 5f 6c 69 73 |_permute|(the_lis|
|00000eb0| 74 2c 20 6c 69 73 74 5f | 73 69 7a 65 2c 20 6c 69 |t, list_|size, li|
|00000ec0| 73 74 5f 73 69 7a 65 2c | 20 63 6f 6c 6c 65 63 74 |st_size,| collect|
|00000ed0| 2c 20 70 61 72 61 6d 29 | 3b 0d 7d 0d 0d 6c 6f 6e |, param)|;.}..lon|
|00000ee0| 67 20 4c 6f 6e 67 52 61 | 6e 64 6f 6d 28 6c 6f 6e |g LongRa|ndom(lon|
|00000ef0| 67 20 6d 69 6e 2c 20 6c | 6f 6e 67 20 6d 61 78 29 |g min, l|ong max)|
|00000f00| 20 7b 0d 09 6c 6f 6e 67 | 20 6e 75 6d 62 65 72 3b | {..long| number;|
|00000f10| 0d 09 6e 75 6d 62 65 72 | 20 3d 20 28 28 52 61 6e |..number| = ((Ran|
|00000f20| 64 6f 6d 28 29 20 26 20 | 30 78 37 46 46 46 29 3c |dom() & |0x7FFF)<|
|00000f30| 3c 31 36 29 20 7c 20 52 | 61 6e 64 6f 6d 28 29 3b |<16) | R|andom();|
|00000f40| 0d 09 72 65 74 75 72 6e | 20 28 6e 75 6d 62 65 72 |..return| (number|
|00000f50| 20 25 20 28 6d 61 78 20 | 2d 20 6d 69 6e 20 2b 20 | % (max |- min + |
|00000f60| 31 29 29 20 2b 20 6d 69 | 6e 3b 0d 7d 0d 0d 23 69 |1)) + mi|n;.}..#i|
|00000f70| 66 20 30 0d 0d 23 69 6e | 63 6c 75 64 65 20 3c 53 |f 0..#in|clude <S|
|00000f80| 74 64 49 4f 2e 68 3e 0d | 0d 51 44 47 6c 6f 62 61 |tdIO.h>.|.QDGloba|
|00000f90| 6c 73 20 71 64 3b 0d 0d | 69 6e 74 20 6d 61 69 6e |ls qd;..|int main|
|00000fa0| 28 76 6f 69 64 29 20 7b | 0d 09 6c 6f 6e 67 20 69 |(void) {|..long i|
|00000fb0| 2c 20 6d 2c 20 6e 2c 20 | 63 6f 75 6e 74 2c 20 66 |, m, n, |count, f|
|00000fc0| 61 63 74 73 5b 33 32 5d | 3b 0d 09 49 6e 69 74 47 |acts[32]|;..InitG|
|00000fd0| 72 61 66 28 26 71 64 2e | 74 68 65 50 6f 72 74 29 |raf(&qd.|thePort)|
|00000fe0| 3b 0d 09 0d 09 70 72 69 | 6e 74 66 28 22 46 61 63 |;....pri|ntf("Fac|
|00000ff0| 74 6f 72 69 61 6c 73 3a | 20 22 29 3b 0d 09 66 6f |torials:| ");..fo|
|00001000| 72 20 28 69 3d 30 3b 20 | 69 3c 37 3b 20 69 2b 2b |r (i=0; |i<7; i++|
|00001010| 29 20 70 72 69 6e 74 66 | 28 22 25 64 20 22 2c 20 |) printf|("%d ", |
|00001020| 46 61 63 74 6f 72 69 61 | 6c 28 69 29 29 3b 0d 09 |Factoria|l(i));..|
|00001030| 70 72 69 6e 74 66 28 22 | 5c 6e 22 29 3b 0d 09 0d |printf("|\n");...|
|00001040| 09 70 72 69 6e 74 66 28 | 22 46 69 62 6f 6e 61 63 |.printf(|"Fibonac|
|00001050| 63 69 3a 20 22 29 3b 0d | 09 66 6f 72 20 28 69 3d |ci: ");.|.for (i=|
|00001060| 30 3b 20 69 3c 37 3b 20 | 69 2b 2b 29 20 70 72 69 |0; i<7; |i++) pri|
|00001070| 6e 74 66 28 22 25 64 20 | 22 2c 20 46 69 62 6f 6e |ntf("%d |", Fibon|
|00001080| 61 63 63 69 28 69 29 29 | 3b 0d 09 70 72 69 6e 74 |acci(i))|;..print|
|00001090| 66 28 22 5c 6e 22 29 3b | 0d 09 0d 09 6d 20 3d 20 |f("\n");|....m = |
|000010a0| 38 38 3b 20 6e 20 3d 20 | 33 32 3b 0d 09 70 72 69 |88; n = |32;..pri|
|000010b0| 6e 74 66 28 22 47 72 65 | 61 74 65 73 74 43 6f 6d |ntf("Gre|atestCom|
|000010c0| 6d 6f 6e 44 69 76 69 73 | 6f 72 28 25 64 2c 20 25 |monDivis|or(%d, %|
|000010d0| 64 29 20 3d 20 25 64 5c | 6e 22 2c 20 6d 2c 20 6e |d) = %d\|n", m, n|
|000010e0| 2c 20 47 72 65 61 74 65 | 73 74 43 6f 6d 6d 6f 6e |, Greate|stCommon|
|000010f0| 44 69 76 69 73 6f 72 28 | 6d 2c 20 6e 29 29 3b 0d |Divisor(|m, n));.|
|00001100| 09 0d 09 70 72 69 6e 74 | 66 28 22 4c 65 61 73 74 |...print|f("Least|
|00001110| 43 6f 6d 6d 6f 6e 4d 75 | 6c 74 69 70 6c 65 28 25 |CommonMu|ltiple(%|
|00001120| 64 2c 20 25 64 29 20 3d | 20 25 64 5c 6e 22 2c 20 |d, %d) =| %d\n", |
|00001130| 6d 2c 20 6e 2c 20 4c 65 | 61 73 74 43 6f 6d 6d 6f |m, n, Le|astCommo|
|00001140| 6e 4d 75 6c 74 69 70 6c | 65 28 6d 2c 20 6e 29 29 |nMultipl|e(m, n))|
|00001150| 3b 0d 0d 09 6e 20 3d 20 | 33 35 37 3b 0d 09 50 72 |;...n = |357;..Pr|
|00001160| 69 6d 65 46 61 63 74 6f | 72 73 28 6e 2c 20 26 63 |imeFacto|rs(n, &c|
|00001170| 6f 75 6e 74 2c 20 66 61 | 63 74 73 29 3b 0d 09 70 |ount, fa|cts);..p|
|00001180| 72 69 6e 74 66 28 22 50 | 72 69 6d 65 20 66 61 63 |rintf("P|rime fac|
|00001190| 74 6f 72 73 20 66 6f 72 | 20 25 64 20 3d 20 22 2c |tors for| %d = ",|
|000011a0| 20 6e 29 3b 0d 09 66 6f | 72 20 28 69 3d 30 3b 20 | n);..fo|r (i=0; |
|000011b0| 69 3c 63 6f 75 6e 74 3b | 20 69 2b 2b 29 20 70 72 |i<count;| i++) pr|
|000011c0| 69 6e 74 66 28 22 25 64 | 20 22 2c 20 66 61 63 74 |intf("%d| ", fact|
|000011d0| 73 5b 69 5d 29 3b 0d 09 | 70 72 69 6e 74 66 28 22 |s[i]);..|printf("|
|000011e0| 5c 6e 22 29 3b 0d 0d 09 | 72 65 74 75 72 6e 20 30 |\n");...|return 0|
|000011f0| 3b 0d 7d 0d 0d 23 65 6e | 64 69 66 0d 00 00 00 00 |;.}..#en|dif.....|
|00001200| 00 00 01 00 00 00 01 6e | 00 00 00 6e 00 00 00 3e |.......n|...n...>|
|00001210| 68 2d 01 0b ea a5 2d 01 | 0c 08 d8 26 01 14 8a 67 |h-....-.|...&...g|
|00001220| 14 2f 0c 20 54 20 50 22 | 68 01 00 8c 31 cc 96 67 |./. T P"|h...1..g|
|00001230| 0a 4c 6f 6e 67 4d 61 74 | 68 2e 63 2d 02 00 00 00 |.LongMat|h.c-....|
|00001240| 54 45 58 54 4d 50 53 20 | 01 00 ff ff ff ff 00 00 |TEXTMPS |........|
|00001250| 00 00 54 45 58 54 4d 50 | 53 20 01 00 ff ff ff ff |..TEXTMP|S ......|
|00001260| 00 00 00 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |........|........|
|00001270| 00 00 ae bb a2 ff 00 00 | 11 7c 00 00 01 ac 00 0c |........|.|......|
|00001280| 42 6e ff f8 3d 7c ff ff | ba 11 41 ed 01 19 c2 2a |Bn..=|..|..A....*|
|00001290| 4c 01 fe e4 28 35 ba 36 | 01 19 ca 2a 4c 01 fe ae |L...(5.6|...*L...|
|000012a0| 28 35 ba 36 01 19 d2 2a | 4c 01 fe 78 28 79 2e 26 |(5.6...*|L..x(y.&|
|000012b0| 10 19 27 72 26 40 20 53 | 20 68 00 10 4a 28 00 6e |..'r&@ S| h..J(.n|
|000012c0| 58 8f 67 46 41 ee ff f0 | 41 ee ff f8 48 6e ff f0 |X.gFA...|A...Hn..|
|000012d0| 2f 2e 00 0c 2f 0c 20 54 | 20 50 22 68 00 2c 4e 91 |/.../. T| P"h.,N.|
|000012e0| 20 54 20 68 b5 58 fc ac | b2 5f 95 95 7d 56 57 5f | T h.X..|._..}VW_|
|000012f0| 57 79 52 50 18 14 3a 4f | ef 00 1c 4c ee 18 00 ff |WyRP..:O|...L....|
|00001300| 00 00 00 48 00 09 47 65 | 6e 65 76 61 00 00 6f 72 |...H..Ge|neva..or|
|00001310| 03 df 87 30 6e 67 2a 20 | 74 68 65 5f 6c 69 73 74 |...0ng* |the_list|
|00001320| 2c 20 6c 6f 6e 67 00 03 | 00 08 00 51 00 32 02 c4 |, long..|...Q.2..|
|00001330| 02 70 00 2e 02 1c 02 a1 | 04 5a b0 5f 54 a5 00 00 |.p......|.Z._T...|
|00001340| 00 24 00 00 02 3d 00 00 | 00 00 01 00 00 00 00 1e |.$...=..|........|
|00001350| 00 51 00 32 02 c4 02 70 | 00 2e 02 1c 02 a1 04 5a |.Q.2...p|.......Z|
|00001360| 00 00 00 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |........|........|
|00001370| 01 00 00 00 01 6e 00 00 | 00 6e 00 00 00 3e 03 d6 |.....n..|.n...>..|
|00001380| 71 38 26 32 00 00 00 1c | 00 3e 00 00 4d 50 53 52 |q8&2....|.>..MPSR|
|00001390| 00 01 00 0a 03 ed ff ff | 00 00 00 00 00 00 00 00 |........|........|
|000013a0| 03 f0 ff ff 00 00 00 4c | 03 d7 c9 e8 00 00 00 00 |.......L|........|
|000013b0| 00 00 00 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |........|........|
|000013c0| 00 00 00 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |........|........|
|000013d0| 00 00 00 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |........|........|
|000013e0| 00 00 00 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |........|........|
|000013f0| 00 00 00 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |........|........|
+--------+-------------------------+-------------------------+--------+--------+