Author |
Message |
gogeta2006
|
Posted: Thu Mar 03, 2005 2:13 pm Post subject: 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 |
|
|
|
|
|
Sponsor Sponsor
|
|
|
jamonathin
|
Posted: Thu Mar 03, 2005 2:35 pm Post subject: (No subject) |
|
|
this should do the trick, if you slow the delay down a little bit, you'll notice every value is decimal.
code: |
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
|
Posted: Thu Mar 03, 2005 2:42 pm Post subject: (No subject) |
|
|
p.s. that extra "else" isn't needed . . . |
|
|
|
|
|
Carino
|
Posted: Thu Mar 03, 2005 3:19 pm Post subject: (No subject) |
|
|
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
|
Posted: Thu Mar 03, 2005 3:33 pm Post subject: (No subject) |
|
|
Carino wrote: 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
|
Posted: Thu Mar 03, 2005 5:33 pm Post subject: (No subject) |
|
|
tony wrote: Carino wrote: 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]
|
Posted: Thu Mar 03, 2005 6:34 pm Post subject: (No subject) |
|
|
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
|
Posted: Thu Mar 03, 2005 6:40 pm Post subject: (No subject) |
|
|
Carino wrote: tony wrote: Carino wrote: 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.... |
|
|
|
|
|
Sponsor Sponsor
|
|
|
Flikerator
|
Posted: Thu Mar 03, 2005 7:03 pm Post subject: (No subject) |
|
|
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
|
Posted: Thu Mar 03, 2005 8:37 pm Post subject: (No subject) |
|
|
Well its just one question in the text book. I was quite suprised to see it myself actually. |
|
|
|
|
|
gogeta2006
|
Posted: Mon Mar 07, 2005 5:49 pm Post subject: 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.... |
|
|
|
|
|
|