Return Styles: Pseud0ch, Terminal, Valhalla, NES, Geocities, Blue Moon. Entire thread

do my homework for me

Name: Anonymous 2012-10-02 17:08

i need a program that finds all the primes under an arbitrary number and puts them on the console

have it ready by thursday at noon you faggots

Name: Anonymous 2012-10-02 17:09

fuck off!

Name: Anonymous 2012-10-02 17:09

if you need help at least ask nicely you lazy twat!

Name: Anonymous 2012-10-02 17:12

Why are you using puts?

Name: Anonymous 2012-10-02 17:19

<a href="C:\My Documents\system32\findprimes.bas">I already did it in my spare time because i am a big nerd! rofl</a>

Name: Anonymous 2012-10-02 17:53


(defun find-primes (n)
  ;left as an exercise for the OP
  )

(find-primes n)

Name: Anonymous 2012-10-02 18:19

You surely remember 3.5.2 Infinite Streams.

(define-syntax delay
  (syntax-rules ()
    ((delay expr)
     (lambda ()
       expr))))

(define-syntax cons-stream
  (syntax-rules ()
    ((cons-stream a b)
     (cons a (delay b)))))

(define (force2 x)
  (x))

(define (stream-car s)
  (car s))

(define (stream-cdr s)
  (force2 (cdr s)))

(define (stream-ref s n)
  (if (= n 0)
      (stream-car s)
      (stream-ref (stream-cdr s) (- n 1))))

(define (stream-null? stream) (null? stream))

(define (stream-filter pred stream)
  (cond ((stream-null? stream) the-empty-stream)
        ((pred (stream-car stream))
         (cons-stream (stream-car stream)
                      (stream-filter pred
                                     (stream-cdr stream))))
        (else (stream-filter pred (stream-cdr stream)))))

(define (integers-starting-from n)
  (cons-stream n (integers-starting-from (+ n 1))))

(define (divisible? x y) (= (remainder x y) 0))

(define (sieve stream)
  (cons-stream
   (stream-car stream)
   (sieve (stream-filter
           (lambda (x)
             (not (divisible? x (stream-car stream))))
           (stream-cdr stream)))))

(define primes (sieve (integers-starting-from 2)))

Name: Anonymous 2012-10-02 18:22


/*****************************************
 * Let's pick an arbitrary number,       *
 * because >>1 didn't specify which one! *
 * I think I'll choose ``1".             *
 *****************************************/

int main(void) { return 0; }

Name: Anonymous 2012-10-02 19:08


long long primes[] ={ 2, 3, 5, 7, 11, 13, 17, 23}; // TODO: ADD THE REST OF THE PRIMES HERE
long long num = 8; // number of primes goes here
int main()
{
     int input = 0;
     printf("number:");
     scanf("%d",&input);
     for(int i = 0; i < num; i++)
     {
          if(primes[i] < input)
          {
               printf("%d",primes[i]);
          }
     }
     return 0;
}

Name: Anonymous 2012-10-02 19:10

There's an incredibly obvious, easy to write algorithm for this, and plenty of examples on the internet.

Name: Anonymous 2012-10-02 19:58

import sys
message = "all the primes under an arbitrary number"
sys.out.write(message)
sys.exit()

Name: Anonymous 2012-10-02 20:02

>>7
beat me to it.

Name: Anonymous 2012-10-02 20:39

>>7
lol sicp. truly a loser's book.

Name: Anonymous 2012-10-02 20:47

god damn you people suck. why the fuck do i have to take comp sci if im a business major???

>>10
just do it you fucking unemployable idiot

>>7
no trial division

Name: achooo 2012-10-02 20:53

This is easy. I'll hint, then you give me a biscuit.

Make an array for primes for N/2,
make and integer, i, with a limit max of N,
Continuously increment i, and test that it is not divisible by 2 and it is not 2,
if not, increase i again and repeat loop from start,

save i to an array of i's,
Test in a loop that prime[i] is not divisible by prime[test],
if not, increase i again and repeat loop from start,

print i

Then print, "I am done teach. give me a biscuit."

Name: Anonymous 2012-10-02 20:56

>>14
god damn you people suck. why the fuck do i have to take comp sci if im a business major???
So the JEWS can get your tuition and use it to let niggers and illegal, unwashed mexicans in for free.

Name: Anonymous 2012-10-02 21:01

>>14
Now you should really quit while you can. I am >>15-kun, And that statement is like say,

"Why do I have to sign things, when all I want to do is own the fucking place?"

Business major is programming revenue, dipshit. If you cannot get simple algorithms, you will never make it past the next month of any you start.

Get a math theory book, and get started, or I will smash personally

Name: Anonymous 2012-10-02 21:03

>>17
i don't care about computers or math. my family already owns a company i just want the degree :)

Name: Anonymous 2012-10-02 21:05

>>18
you are so retarded, that you can't write such a simple algorithm? kill yourself please.

Name: Anonymous 2012-10-02 21:10

>>19
fuck you

Name: Anonymous 2012-10-02 21:10

>>1
so easy even a child, nay, even a woman could do it.

Name: Anonymous 2012-10-02 21:13

So easy, even leah culver could do it. take that, `bussiness major'!

Name: Anonymous 2012-10-02 21:16

>>21
NICE

OP, for the sakes the rest of your life, either kill yourself, or go to the art department. You do not deserve the degree with that mentality. Or even your computer.

Name: Anonymous 2012-10-02 21:24

>>23
i'm not a fucking faggot art student and im not about to hang out with faggots who obsesses over the size of a cock in some abstract bullshit and thinks it means the stuggle of man to fight the cops or or some equally retarded

and BA is way worse than a BS

Name: Anonymous 2012-10-02 21:27

Sure, it's easy, but is it Abelson easy?

Name: Anonymous 2012-10-02 21:30

>>24
No wonder you can't program, you can barely even speak English. Might be best to drop out and stick with manual labor.

Name: Anonymous 2012-10-02 21:33

>>24
I love it when you fall in your trap. See you in art class. I would love to see your Dark Oppressive art.

Name: Anonymous 2012-10-02 21:36

>>14
Learn JAVA!

Name: Anonymous 2012-10-02 21:36

>>26
>>27
fuck you both

>>27
but especially fuck you

Name: Anonymous 2012-10-02 21:58

>>29
still can't code this child's algorithm?

Name: Anonymous 2012-10-02 22:01

that was leah culver quality!

Name: Anonymous 2012-10-02 22:02

babby's first algorithm

Name: Anonymous 2012-10-02 22:05

How's your business degree going, Leah?

Name: leah culver 2012-10-02 22:07

I'm printing the hard-coded array [2 3 5 7 ...], but there must be some `mathematical' way of doing it, i just can't remember how.

Name: Leah Culver 2012-10-02 22:12

That seems to me like something people would remember if they had used it before. I’d never had to print prime numbers before and I kept thinking that there was some way to do it mathematically, but I couldn’t remember how. I hope it’s not as important to know the best solution as it is to know a better solution exists.

Name: Anonymous 2012-10-02 22:56

Enjoy fucking Richard Stallman's hairy man boobs while the sweet Leah is rubbing my dick between her white, soft, aryan, valkyriesque mammaries.

Name: Anonymous 2012-10-02 22:58

>>36
Enjoy scraping your dick on those acne scars.

Name: Anonymous 2012-10-02 23:16

>>36
back to /3DPD/, ``please''

Name: Anonymous 2012-10-02 23:25

>>36
enjoy your fantasy.

Name: Anonymous 2012-10-02 23:25

``please"

Newer Posts
Don't change these.
Name: Email:
Entire Thread Thread List