Julia Fractals (type Byers)
QBASIC and QuickBASIC compatible code (see below) to generate fractals similar to picture. A 486 computer or 386 with math processor is highly recommended since the SQR (square-root function) takes considerable time otherwise. The program also demonstrates how to get 64*64*64 = 262144 (256K) different colors assuming you have 256K video memory and a VGA color monitor (IBM-compatible computers). Also, only 16 different colors of any of the 256K colors can be shown in any picture. The PALETTE command can change the color of any of the 16 possible in the picture. Combinatorial mathematics can solve how many different combinations of 16 colors can be chosen from among the 262144 colors. The formula is 262144!/(16!*(262144-16)!) where ! stands for factorial. The fantastic number is 4.97*10^86/2.092*10^13 = 2.376*10^73 combinations. I use the ^ to mean to the power of. If one looked at all possible combinations each one for just a millisecond, then it would take trillions and trillions of times longer than the universe is old (15 billion years). Another comparison is that if there are 1 million grains of very fine sand in a cubic centimeter then there are 10^33 grains of this sand in the earth and if there are a trillion earths in a galaxy and a trillion galaxies in the universe then there is still only 10^57 grains of sand in the universe (much less than the number of possible color combinations)!

10 CLS : A = RND(-TIMER): SCREEN 12: DEFINT K: XS = 640: YS = 480
20 IT = XS / 2: JT = YS / 2: S = 3 / YS: T = 3 / XS
30 P = RND * .15 + .38: Q = RND * .15 + .04
40 FOR YY = -1.6 TO 1.6 STEP S: FOR XX = -1.4 TO 1.4 STEP T
50 X = XX: Y = YY: K = 0: I = XS / 3 * XX + IT: J = YS / 3 * YY + JT
60 A = X * X - SQR(ABS(Y)) * SQR(ABS(Y)) * P: IF A\$ = CHR\$(27) THEN END
70 B = 2 * SQR(ABS(X)) * SQR(ABS(Y)) + Q: X = A: Y = B: K = K + 1
80 M = X * X + Y * Y: IF K > 32 THEN 100
90 IF M < 4 THEN 60 ELSE GOSUB 130
100 NEXT: A\$ = INKEY\$: NEXT
110 A\$ = INKEY\$: IF A\$ = "" THEN GOSUB 120: GOTO 110 ELSE 30
120 K = INT(RND * 15)
130 I = XS / 3 * XX + IT: J = YS / 3 * YY + JT: PSET (I, J), K MOD 15
140 IF RND < .001 THEN
150 BLUE% = INT(RND * 63) + 1: GREEN% = INT(RND * 63) + 1
160 RED% = INT(RND * 63) + 1: CN& = 65536! * BLUE% + 256 * GREEN% + RED%
170 PA% = INT(RND * 15) + 1: PALETTE PA%, CN&
180 END IF: RETURN

(C) 1995 by John A. Byers