Wrote out the Sieve of Eratosthenes by hand to work through the algorithm. I used a boolean array of size 11 and ran through it by hand. Can't seem to see where the loop sets 9 to be false. I was left with 4, 6, 8, 10 set to false, and 2, 3, 5, 7, and 9 set to TRUE. But 9 is prime, so what am I missing here?
I performed the sieve prime example and set 'n' to ten and it printed out all primes up to ten. Is that the correct result? I'm a Flash programmer so I simply changed the syntax for AS3.0 and wrote a class. Unfortunately, I don't think you can actually create a Boolean array in AS (possibly as a 'rest array' as a function argument and set the return value as Boolean(?)), so I simply created an array and set it to true in the 'for' loop.
I think what looks like a field, in many cases, is actually a call to a getter method. Otherwise, how else would it be able to perform any useful function (?) If my logic is flawed, I'd like to be corrected.
at around minute 2, it does not need to check all the numbers up until n, since the biggest divisor is always n/2, and this saves half the iterations on the while loop.
Its really not a very good example to a while loop, since it could be done simply by a for cycle. While loops are usually applied when you don't really know how many iterations you will have.
He Made an error in 10:23 where he changes the IsPrime Method to use for Loop he forgot to Erase at the end the divisor++; because he has it in the for loop so it does not make sence to have divisor++; in the end of the program will not work like it suppose to!!
i saw that too, but the board was covering that extra divisor++ statement when he was writing the for loop...honestly, i don't know why he uses a chalkboard to write out all of his code anyway...
@skyflashings It makes a change to see someone that is prepared to spend their time writing it out by hand. If I did that, I would be non sensical becuase my writing is ass.
Thank you Gentlemen;
{I will now go to have a wonder cup of English tea[]}
TheAhmedMAhmed 4 weeks ago
Arrays in java are objects...i agree of that... but where did they fit in the class hierarchy. any answer please..
eem553 2 months ago
Wrote out the Sieve of Eratosthenes by hand to work through the algorithm. I used a boolean array of size 11 and ran through it by hand. Can't seem to see where the loop sets 9 to be false. I was left with 4, 6, 8, 10 set to false, and 2, 3, 5, 7, and 9 set to TRUE. But 9 is prime, so what am I missing here?
xwowsersx 10 months ago
@xwowsersx 9 isn't prime...
spartanfry 8 months ago
@spartanfry yea, i meant "but 9 ISN'T prime." Doesn't matter anyways...figured it long ago.
xwowsersx 8 months ago
@xwowsersx Sorry about that, I did not notice this was posted a month ago until after I posted the comment.
spartanfry 8 months ago
@spartanfry no worries. just cuz it was a month ago, doesnt mean i wasnt still struggling. thanks!
xwowsersx 8 months ago
good man with great knowledge......
Bharatwaj89 1 year ago
8:34 his voice cracks =), what a great teacher this man is.
programmer1905 1 year ago
I performed the sieve prime example and set 'n' to ten and it printed out all primes up to ten. Is that the correct result? I'm a Flash programmer so I simply changed the syntax for AS3.0 and wrote a class. Unfortunately, I don't think you can actually create a Boolean array in AS (possibly as a 'rest array' as a function argument and set the return value as Boolean(?)), so I simply created an array and set it to true in the 'for' loop.
wrdeboise 1 year ago
I think what looks like a field, in many cases, is actually a call to a getter method. Otherwise, how else would it be able to perform any useful function (?) If my logic is flawed, I'd like to be corrected.
wrdeboise 1 year ago
at around minute 2, it does not need to check all the numbers up until n, since the biggest divisor is always n/2, and this saves half the iterations on the while loop.
Its really not a very good example to a while loop, since it could be done simply by a for cycle. While loops are usually applied when you don't really know how many iterations you will have.
ngarcia65 2 years ago
Comment removed
DrGenius73 1 year ago
Later in lecture he uses the sieve of Eratosthenes to implement a much faster way of finding a range of primes.
DrGenius73 1 year ago
Comment removed
1ackee 2 years ago
Comment removed
1ackee 2 years ago
ROck on!!!!
amightyo 2 years ago 4
extremely clear! Very interesting for students of Informatics.
cristianigianni 2 years ago 12
He Made an error in 10:23 where he changes the IsPrime Method to use for Loop he forgot to Erase at the end the divisor++; because he has it in the for loop so it does not make sence to have divisor++; in the end of the program will not work like it suppose to!!
elcapino85 3 years ago 12
i saw that too, but the board was covering that extra divisor++ statement when he was writing the for loop...honestly, i don't know why he uses a chalkboard to write out all of his code anyway...
skyflashings 2 years ago
@skyflashings It makes a change to see someone that is prepared to spend their time writing it out by hand. If I did that, I would be non sensical becuase my writing is ass.
0121ryanh117 1 year ago
it looks like he left it in from when he did the while loop, you would need it there.
jimed 2 years ago
Doesn't the loop in the Pascal triangle method needs variables I and J for looping sake ?
availableaccount 3 years ago