Scritto da
avvelentani
Cubicolario
il 2009-01-23 17:21:00.0 alle 2009-01-23 17:21:00.0
Trollate totali: 18184
Esercizio: scrivere un programma che calcola i numeri primi.
Svolgimento:
To write this program, we first connected our computer to the Internet,
downloaded some music from Napster, and then read our email. (You have
to receive email to perform a workday [11]). We received 25 pieces of email of
which 16 were advertisements for Internet pornography, administrivia, or invi-
tations to invest in Nigerian currency trades. After dealing with this email, we
typed calculate prime numbers into Google. This found several web sites
regarding prime numbers, and some more pornography. After a while, we
were interrupted, and so moved on to the prime number web sites. In particu-
lar, http://www.2357.a-tu.net
includes the ALGOMATH C library for
calculating prime numbers; another site included an EXCEL macro which was
to complex to understand. Although we had not programmed in C for years,
after downloading and compiling the library (by typing make), we noticed the
documentation included the following program:
int *pointer , c=0;
if((pointer = am_primes_array(4, 3)) == NULL)
printf("not enough memory\n");
while( *(pointer+c)){
printf("%d\n",*(pointer+c));
c++;
}
return;
We cut and pasted this program into a file and compiled it several times,
having to add a few extra lines (e.g. main () {). Eventually we ran it, and in-
deed it appeared to generate three prime numbers larger than four. We edited
the parameters to am_primes_array to (2,1000), and then ran the output
through wc -l to check that it had printed 1000 numbers.
Here we have completed what we announced at the beginning of this sec-
tion, viz. to describe in very great detail the composition process of such a
[postmodern] program.
Svolgimento:
To write this program, we first connected our computer to the Internet,
downloaded some music from Napster, and then read our email. (You have
to receive email to perform a workday [11]). We received 25 pieces of email of
which 16 were advertisements for Internet pornography, administrivia, or invi-
tations to invest in Nigerian currency trades. After dealing with this email, we
typed calculate prime numbers into Google. This found several web sites
regarding prime numbers, and some more pornography. After a while, we
were interrupted, and so moved on to the prime number web sites. In particu-
lar, http://www.2357.a-tu.net
includes the ALGOMATH C library for calculating prime numbers; another site included an EXCEL macro which was
to complex to understand. Although we had not programmed in C for years,
after downloading and compiling the library (by typing make), we noticed the
documentation included the following program:
int *pointer , c=0;
if((pointer = am_primes_array(4, 3)) == NULL)
printf("not enough memory\n");
while( *(pointer+c)){
printf("%d\n",*(pointer+c));
c++;
}
return;
We cut and pasted this program into a file and compiled it several times,
having to add a few extra lines (e.g. main () {). Eventually we ran it, and in-
deed it appeared to generate three prime numbers larger than four. We edited
the parameters to am_primes_array to (2,1000), and then ran the output
through wc -l to check that it had printed 1000 numbers.
Here we have completed what we announced at the beginning of this sec-
tion, viz. to describe in very great detail the composition process of such a
[postmodern] program.
I think happiness is love
- Vladimir Putin
- Vladimir Putin
-
Numeri Primi @ 2009-01-23 17:21:00.0 di avvelentani
-
■ @ 2009-01-23 20:31:00.0 di alex.tg
-
■ @ 2009-01-23 17:23:00.0 di Non Autenticato
-