POV-Ray : Newsgroups : povray.newusers : Prime numbers : Re: Prime numbers Server Time
10 Aug 2022 16:46:50 EDT (-0400)
  Re: Prime numbers  
From: Tor Olav Kristensen
Date: 13 Jan 2022 16:45:00
Message: <web.61e09d2fb91bd52025bd47a389db30a9@news.povray.org>
"Cabesa" <adr### [at] gmailcom> wrote:
> Now, this is quite a simple request- but I ve been unable to do so myself and
> have no idea how to accomplish it.
> Let me explain:
>
> I have a ".txt" file, with a random number. The idea is to debug a message that
> states whether said number is prime or not. Now,this should be quite an easy
> task, but i dont seem to wrap my head around it and dont know witch "ifs" or
> "whiles" to put so that the programme knows if the number meets with the
> condition.
>
> Thanks in advance (for those that read this far)

Hi Cabesa

There are some "ifs" and "whiles" for you in the examples under "Simple
methods" on this page:

https://en.wikipedia.org/wiki/Primality_test

"i ** 2" and "n % (i + 2)" in Python can be written as "pow(i, 2)" and "mod(n, i
+ 2)" in POV-Ray's SDL.

--
Tor Olav
http://subcube.com
https://github.com/t-o-k


Post a reply to this message

Copyright 2003-2021 Persistence of Vision Raytracer Pty. Ltd.