Prime numbers

Prime numbers - Messages

#1 Posted: 1/5/2012 6:06:30 PM
amit28it

amit28it

0 likes in 16 posts.

Group: User

Like calculator can we check which are prime and which are not in list of prime numbers to 100 and use of these nummbers a/c to runtime .Can you tell us this ? What the cause behind that?
#2 Posted: 1/7/2012 10:47:18 PM
Edward Ulle

Edward Ulle

20 likes in 182 posts.

Group: Moderator

Not sure what your looking for but here is a simple routine to find prime numbers between 1 and 100.

[LIVE width=350 height= 800]http://smath.info/live/?file=3409[/LIVE]

Does anyone know how to do if without else?
Ed
#3 Posted: 1/8/2012 4:40:23 PM
Radovan Omorjan

Radovan Omorjan

325 likes in 2052 posts.

Group: Moderator

Hello Ed,

If I understood you well, you are asking for "if" without "else" because you needed this structure in your example above. As far as know, there is only one "if" structure, function in SMath, - "if" with 3 arguments. We could just make "if" function with two arguments this way:
[LIVE width=267 height=423]http://smath.info/live/?file=3415[/LIVE]
and use it in our worksheets. The drawback of this one is that the "if" defined this way can not have a "line" structure as a second argument (not quite sure about that) although the second argument could be a function call.
[LIVE width=220 height=241]http://smath.info/live/?file=3418[/LIVE]

I am not sure, but I think that Andrey can not make two "if" operators in programming palette. It would be a problem to distinguish them. I am not sure again, but I hope there would be possible to put if(2) and if(3) in the function list and, therefore, having both "if" structures - with and without "else".

Regards,
Radovan
When Sisyphus climbed to the top of a hill, they said: "Wrong boulder!"
  • New Posts New Posts
  • No New Posts No New Posts