rem  >  pgms.harmony.HARM92/11.SimpleText
date:  15.Jun.98  20:42  pm.  nzst.
from:  dsmcdona@actrix.gen.nz
subject:  A Sieve Algorithm for MOBIUS Function.
newsgroups:  sci.math.
		=================================

My-Prog  'SIMPLEMobi.us' calculates and prints
the Mobius arithmetic function, Mu(1) to
Mu(160 000), in 4 minutes on Acorn Archimedes A4000
RISC OS Computer with 2MB RAM.   (1993 era computer.)

BBC BASIC V-64.
Program size =  1450 bytes. (e.g. very small.)
Related prog in Acorn ANSI-'C'.

The Partial Harmonic Series, S_n = 1/M = 1 -1/2 -1/3..
-5' +6' -7' +10' -11' -13' +14' +15' ...

has a minimum at S_56359 = 1/-2209 90748.

The prog uses an Integer Type array
DIM R%( MAXR ).
MAXR = 160 000 or smaller.

Memory could be made to go further if the number
of distinct prime divisors of square-free integers
would be stored as a byte-units of storage.

Initial output.  (Sample.)

For further information please email..
--
dsmcdona@actrix.gen.nz


*simplemobi
REM  > HARM92/11. SIMPLEMobi.us   by
 dsmcdona@actrix.gen.nz,  15.06.1998.

Time = 0  Seconds.
Enter MAXR=160 000   (0 = quit)?500
PRIMES.
2,  3,  5,  7,  11,  13,  17,  19,  23,  29,  31,  37,  41,  43,  47,  
53,  59,  61,  67,  71,  73,  79,  83,  89,  97,  101,  103,  107,  109,  
113,  127,  131,  137,  139,  149,  151,  157,  163,  167,  173,  179,  
181,  191,  193,  197,  199,  211,  223,  227,  229,  233,  239,  241,  
251,  257,  263,  269,  271,  277,  281,  283,  293,  307,  311,  313,  
317,  331,  337,  347,  349,  353,  359,  367,  373,  379,  383,  389,  
397,  401,  409,  419,  421,  431,  433,  439,  443,  449,  457,  461,  
463,  467,  479,  487,  491,  499,  

PRINT TABLE.  (Number of Prime Divisors of Non-Square-Frees.)
         1     6     11    16    21    26    31    36    41    46
0        21101 21002 10122 01010 22100 20013 10222 01220 13100 21000
50       20102 02210 12002 31023 10120 02310 02102 22010 20222 01000
100      13103 21013 20132 00220 02200 01023 10220 01310 22202 20010
150      10032 01220 20103 21003 00130 02210 13202 32003 10123 01010
200      22202 20024 10222 02220 23100 21013 30102 02310 10000 32020
250      10223 01320 02102 32010 10320 01200 13103 32003 20102 00220
300      22202 01023 10120 01320 23200 22024 10022 01020 20003 21010
350      00132 03210 02002 31003 20130 02010 22103 20014 20222 01230
400      13200 32013 20202 02310 12000 32033 10133 02310 03102 22010
450      20223 01200 14103 21023 20230 00210 22302 01020 10230 02310
continue.  0 = Mu 0,  1 = Prime, Mu -1,  2 = Mu +1, Mu = (-1)^r. 

         1     6     11    16    21    26    31    36    41    46
500      
Subscript out of range
Time = 8  Seconds.
Enter MAXR=160 000   (0 = quit)?
*SIMPLEMobi.us  e n d.*
*sp.
