https://secure.csse.uwa.edu.au/run/help1401?p=np&rss=y
The help1401 RSS feedThe help1401 RSS feedhelp1401https://blogs.law.harvard.edu/tech/rssThe University of Western AustraliaWed, 15 Apr 2020 23:34:35 +0800Wed, 15 Apr 2020 23:34:35 +0800Regarding the use of math function in project 1
https://secure.csse.uwa.edu.au/run/help1401?p=np&a=2
https://secure.csse.uwa.edu.au/run/help1401?p=np&a=2Wed, 15 Apr 2020 23:34:35 +0800ANONYMOUSIs it okay to use the math functions like min,max in
project 1.
Thanks and regards
Re: Not able to understand the question
https://secure.csse.uwa.edu.au/run/help1401?p=np&a=1
https://secure.csse.uwa.edu.au/run/help1401?p=np&a=1Mon, 23 Mar 2020 19:09:51 +0800"Edward Atkinson" <22487668@student.uwa.edu.au>
I don't have access to your labsheet, so forgive me if I'm repeating information that you already know.
When faced with a problem I don't understand I find it's important to think about the elements of the problem and try to follow along with an example.
So let's start off first with the definition of a composite number (I've taken this one from Wikipedia):
>"A composite number is a positive integer that can be formed by multiplying two smaller >positive integers. Equivalently, it is a positive integer that has at least one divisor >other than 1 and itself."
So, a composite n is a number for which the following conditions hold:
1. n is not prime.
2. n is not 1.
So a function generating the nth composite would simply find the nth number which is not 1 or prime.
Given that you are writing a function called composite2 I can only assume you've written a function composite which generates the nth composite number.
If that is the case composite2 need only add the condition that any composite n is not divisible by 2.
To do this should be relatively trivial. I suggest you look into the modulus operator (%) in programming and how it can be used to check if a number is divisible by two.
Hope that helps!
Not able to understand the question
https://secure.csse.uwa.edu.au/run/help1401?p=np&a=0
https://secure.csse.uwa.edu.au/run/help1401?p=np&a=0Mon, 23 Mar 2020 14:41:55 +0800"Rishee Barthakur" <22894636@student.uwa.edu.au>Write a function composite2(N) which takes an integer N as an input and returns the
Nth composite number which is NOT divisible by 2. For instance, composite2(3) returns
21 while composite2(5) returns 27.