pearselab / r-intro-jenessalemon

r-intro-jenessalemon created by GitHub Classroom
0 stars 1 forks source link

lesson #4 #4

Open sylviakinosian opened 7 years ago

sylviakinosian commented 7 years ago

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

willpearse commented 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...)

jenessalemon commented 7 years ago

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.

willpearse commented 7 years ago

It would be better if it printed everything on the same line. So, for example, it would say "Good: 5".