#๐Ÿ”’ Why is this prime sieve adding and witholding some numbers?

18 messages ยท Page 1 of 1 (latest)

sly ventureBOT
#

@signal crystal

Python help channel opened

Remember to:

  • Ask your Python question, not if you can ask or if there's an expert who can help.
  • Show a code sample as text (rather than a screenshot) and the error message, if you've got one.
  • Explain what you expect to happen and what actually happens.

:warning: Do not pip install anything that isn't related to your question, especially if asked to over DMs.

uncut minnow
#

I suggest you run it with a debugger and investigate it line by line to find the cause

manic adder
#

It doesn't leave out 5.

wraith merlin
#

This code is very hard to read, naming variables a single letter is a bad practice

manic adder
#

I think a single letter is fine for variables like x, y, and n or i. Adding more characters won't make them more expressive.

summer gate
#

if you name a variable by their function or use its more helpful to look into in later into the code

#

personally i wont remember what n does by last line

manic adder
#

Eh, but for example the x variable is just that. It has no meaning beyond that. It's from a mathematical formula like 4xยฒ+yยฒ=n

summer gate
#

i know sieve of erasthones brother

manic adder
#

Atkin wasn't the brother of Eratosthenes. He was born about 2200 years later. ๐Ÿ™‚

wraith merlin
wraith merlin
signal crystal
#

!close

sly ventureBOT
#
Python help channel closed

This help channel has been closed and it's no longer possible to send messages here. If your question wasn't answered, feel free to create a new post in #1035199133436354600. To maximize your chances of getting a response, check out this guide on asking good questions.