<div>Hello,</div><div><br></div>Well, no one here is gonna do your homework!<div>You could start showing what you've done so far and asking more specific doubts.</div><div><br></div><div>We are not code translation robots...</div>
<div><br></div><div>[]'s</div><div><br clear="all">Rodolfo Carvalho<br>
<br><br><div class="gmail_quote">2011/7/14 飞刀 <span dir="ltr"><<a href="mailto:fly3ds@qq.com" target="_blank">fly3ds@qq.com</a>></span><br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
Hello everyone,<br><br>I want a program to verify prime numbers which can be runned in mzscheme. The following is C source. I don't konwn how to convert it to lisp.<br><br>Thanks.<br><br>#include <stdio.h><br>
#include <time.h><br>#include <math.h><br>#include <string.h><br>#include <stdlib.h><br><br>#define E6 1000000<br><br>char table[E6];<br>int num = 0;<br>//int prime[E8];<br><br>void cal_table()<br>
{<br>int j, k;<br>time_t t1, t2;<br>t1 = time(NULL);<br>memset(table, 1, E6);<br>for (j = 2 ; j < E6; j++) {<br>if ( table[j] ) {<br>num++;<br>for ( k = j + j; k < E6; k += j )<br>{<br>table[k] = 0;<br>}<br>}<br>}<br>
t2 = time(NULL);<br>printf("Totaly %d primes until E6, cost %d time_t.\n", num, t2 - t1);<br>}<br><br>/*<br>void init_prime()<br>{<br>int i;<br>num = 0;<br>printf("Init prime start...");<br>for (i = 2; i < 2*E9; i++) {<br>
if (table[i])<br>prime[num++] = i;<br>}<br>printf("Init prime finished...");<br>}<br>*/<br><br>int main()<br>{<br>int i;<br>cal_table();<br>//init_prime();<br>return 0;<br>}<br><br><br>_________________________________________________<br>
For list-related administrative tasks:<br>
<a href="http://lists.racket-lang.org/listinfo/users" target="_blank">http://lists.racket-lang.org/listinfo/users</a><br></blockquote></div><br></div>