🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Thread View: cn.bbs.comp.os2
1 messages
1 total messages Started by л��ͥ Wed, 26 Nov 1997 00:00
������, Pentium MMX 200 ���� >> RS6000 59H
#11
Author: л��ͥ
Date: Wed, 26 Nov 1997 00:00
103 lines
4028 bytes

����Ķ�����һ�����Ǻõ�, ������һС�������һ��, 
��Ҫ�����Ǽ�������(���Ǵ�ѧһ�꼶��Ҫ�ı�̼���)
������, û�б��.

�ȽϽ������:

                Pentium MMX 200           RS/6000 59H

CPU             MMX 200                   RISC ??? (sorry, 59h��CPU?)

�ڴ�            64M                       256M

����ϵͳ        Linux kernel 2.0.30       AIX 4.1 (��õ���jfs, sigh, 
                                             linuxҲ�оͺ���)

������UID       root                      root

����ʱϵͳ����  0.00, 0.00, 0.00          0.00, 0.00, 0.00

���������      2.7.2.2 for Linux         2.7.2.2 for AIX

�����ҵij���
  ���:

1�����������
  ����:         506291                     275754

��ɵ����һ��
   ������:      7468759                    3887311

������:       Pentium MMX����ܲ�����? �������ҵij���ֻ������
                ����, ������������������, ����������������
                ��, rs/6000����ǰ�� �������ڿ��ѱ�����ۿ�, 
                ����, �ó�����ЩƬ��, �������ʹ��aix��ccֱ�ӱ���
                �Ļ�, ����������һ�����, ����ȫ���ܹ��ﵽ�����
                MMX�ٶ�.

                ��֪��λ�кθ߼�? �Լ�������ij������һ�����Կ�.

�������嵥: (prime3.c)
���³�����tc, gcc, wcl386(watcom c), cc(Sun&AIX&Ultra&Alpha)����ͨ��.
gcc -o prime3 prime3.c

---------------- start here ----------------


#include <stdio.h>
#include <time.h>

#define max 8952     /* enough to count all long primes, do not change it */
#define duration 60   /* in seconds, 0 for no time-controlling */
#define report_rate 100  /* report every 100 primes, 0 for none */

main()
{
  long prime[max];
  long divident, gate, threshold, biggest, count;
  int index, step;
  time_t time_begin, dumb;

  time_begin=time(&dumb);
  prime[0]=2L; count=1L;  /* first prime */
  threshold=0L; gate=9L; step=report_rate-1;
  if (report_rate==0) printf("Calculating, do not disturb ... ");
  for (divident=3L; divident<0x7fffffffL; divident+=2L)
  {
    if (divident==gate)
    {
      threshold++;
      gate=prime[threshold+1]*prime[threshold+1];
      continue;
    }
    index=1;
    while (index<=threshold && divident%prime[index]!=0) index++;
    if (index>threshold)  /* a prime found */
    {
      biggest=divident;
      if (count<max) prime[count]=divident;
      count++;
      if (report_rate!=0)
      {
        step--;
        if (step<=0)
        {
          printf("%ld: %ld\n", count, divident);
          step=report_rate;
        }
      }
      if (duration!=0)
        if (time(&dumb)-time_begin>=duration)
          break;
    }
  }
  printf("%ld primes generated, the biggest is %ld, %ld seconds used.\n",
         count, biggest, time(&dumb)-time_begin);
}

-------------- end here. ---------------------

--
�� ��Դ:���������� cs3.xmu.edu.cn��[FROM: cs3.xmu.edu.cn]
Thread Navigation

This is a paginated view of messages in the thread with full content displayed inline.

Messages are displayed in chronological order, with the original post highlighted in green.

Use pagination controls to navigate through all messages in large threads.

Back to All Threads