
-----------------------------------
gogeta2006
Thu Mar 03, 2005 2:13 pm

PLEASE HELP !!!!!
-----------------------------------
Hey guys this is my first post ...please help me...
ok see im doing "geometry and discrete mathematics" grade 12 course and there is a question which says:

" It is claimed that the expression n^2 -79n +1601 generates a prime number for all integers values of n from 1 to 200. Write a computer program to determine whether or not a given number is prime and use it to test the claim."

Did anyone do this type of program before ...please guys im in deep crap :(  please help.....thanx in advance

-----------------------------------
jamonathin
Thu Mar 03, 2005 2:35 pm


-----------------------------------
this should do the trick, if you slow the delay down a little bit, you'll notice every value is decimal.

var t : int := 1
var hold : string
for n : 1 .. 200
    t := n ** 2 - 79 * n + 1601
    for i : 1 .. n
        hold := erealstr (t / i, 1, 1, 1)
        if strintok (hold) then
            put strint (hold)
        else
        end if
    end for
    put n, ". ", hold
    delay (5)
end for


-----------------------------------
jamonathin
Thu Mar 03, 2005 2:42 pm


-----------------------------------
p.s.  that extra "else" isn't needed . . .

-----------------------------------
Carino
Thu Mar 03, 2005 3:19 pm


-----------------------------------
Your teacher expects you to do that question? wow we had the same one but she never assigned it to us, its kinda stupid to tell students to make a program when they never have before.

-----------------------------------
Tony
Thu Mar 03, 2005 3:33 pm


-----------------------------------
its kinda stupid to tell students to make a program when they never have before.
Well otherwise they'll be doing the same damn "Hello World" every single day.

-----------------------------------
Carino
Thu Mar 03, 2005 5:33 pm


-----------------------------------
its kinda stupid to tell students to make a program when they never have before.
Well otherwise they'll be doing the same damn "Hello World" every single day.

Umm... this is a MATH CLASS.. not COMP SCI... so why would a teacher assign a PROGRAMMING question in MATH CLASS.

-----------------------------------
[Gandalf]
Thu Mar 03, 2005 6:34 pm


-----------------------------------
Exactly my thinking...  I would think that it is just a theoretical question.  They would have to learn quite a bit of a programming language just for a stupid question, in a short amount of time  :? .

-----------------------------------
ssr
Thu Mar 03, 2005 6:40 pm


-----------------------------------
its kinda stupid to tell students to make a program when they never have before.
Well otherwise they'll be doing the same damn "Hello World" every single day.

Umm... this is a MATH CLASS.. not COMP SCI... so why would a teacher assign a PROGRAMMING question in MATH CLASS.
MATH CLASS!!!!!!!!!!!!!
damn what school r u ur guys in
making a program in math??
ummmm....

-----------------------------------
Flikerator
Thu Mar 03, 2005 7:03 pm


-----------------------------------
Programming in math? That would be so awsome! I wish we did that in my math class, that would be so awsome! So fun it would be for me, to program and do math, my two best subjects in one...

-----------------------------------
Carino
Thu Mar 03, 2005 8:37 pm


-----------------------------------
Well its just one question in the text book. I was quite suprised to see it myself actually.

-----------------------------------
gogeta2006
Mon Mar 07, 2005 5:49 pm

THANKX SOOO MUCH
-----------------------------------
Hey guys thankx for all your help...you guys are great...i dont know why she assigned us this question...although it is math class....once again compsci rules and you guys are great...thankx once again....
