0
Syntax Error Help
I’m having trouble rectifying a syntax error in my code. I’ve tried rewriting it in various ways but I can’t seem to quite get it right. The premise of the code is to use the fact that all squares of primes, except those of 2 and 3, are one more than a multiple of 24 to generate of list of primes by using a set to eliminate duplicate answers. Any help would be much appreciated. https://code.sololearn.com/c8ka3We8Wc0t/?ref=app
3 Antworten
+ 1
Problem 1:
on line 8, you’re missing some closing parentheses
Problem 2:
You didn’t import the floor function
Problem 3:
you forgot to call your function with a parameter
0
Try replacing 'x' with 'i' when defining 'y' (24*sqrt(i)+1) and also put an asterisk behind your set to unpack it when printing: "print(*primes)". Doing all that will still not generate primes for you though, you'd need a different algorithm for that.
0
Addendum to my post, only the whole number values of y represent the primes. Thanks to all who have helped out so far.