Syntax Error Help | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
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

18th Dec 2019, 1:06 AM
Pythagoras
Pythagoras - avatar
3 Answers
+ 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
18th Dec 2019, 1:20 AM
Rora
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.
18th Dec 2019, 8:28 PM
Zuke
Zuke - avatar
0
Addendum to my post, only the whole number values of y represent the primes. Thanks to all who have helped out so far.
18th Dec 2019, 8:36 PM
Pythagoras
Pythagoras - avatar