Open sylviakinosian opened 7 years ago
This is correct. I'm also afraid that anything divisible by five cannot be a prime number (except for 5, of course...)
Sylvia, when I run my code here is the output: [1] "Good:" [1] 5 [1] "Job:" [1] 5 [1] "Good:" [1] 10 [1] "Good:" [1] 15 [1] "Good:" [1] 20 Which I believe is what it's supposed to do. Not sure why it isn't working for you.
It would be better if it printed everything on the same line. So, for example, it would say "Good: 5".
I just ran your code (after talking to you about it) and the output is:
[1] "Good:" [1] 5 [1] "Good:" [1] 10 [1] "Good:" [1] 15 [1] "Good:" [1] 20
..which i think is not exactly what you were describing to me? I think it's because you say:
if (i %% 5 == 0 & prime(i) == TRUE){ print("Job:") print(i) }
so it will only print JOB when a number is prime and divisible by 5