Group Abstract Group Abstract

Message Boards Message Boards

0
|
7.6K Views
|
2 Replies
|
0 Total Likes
View groups...
Share
Share this post:

Sort out primes up to the 1000th count?

Posted 9 years ago

What is wrong with this code

(mp = Table[{i, PrimeQ[2^i - 1]}, {i, 2, 1000}])
Select[mp, #[[2]] = True &][[All, 1]] # is an undefined part of set.

I am working with the Mathematica Navigator and this is straight out of his book but I would like to change it to factor the first 1000 prime numbers rather than factor primes up to the count of 1000. What level of mathematics does this correspond to? Would I normally encounter this in Algebra 2? or is higher math involved?

POSTED BY: Leighton Cooper
2 Replies

Thanks that did the trick.

POSTED BY: Leighton Cooper
Posted 9 years ago

Add a semicolon and substitute == for = and the code appears to work

mp = Table[{i, PrimeQ[2^i - 1]}, {i, 2, 1000}];
Select[mp, #[[2]] == True &][[All, 1]]

Next, factoring primes is easy. Can you reword that sentence to make you goal more understandable?

Factoring can be just simple trial division or it can use more advanced methods to try to do this faster. Some of those methods can lead into the subject of number theory which is usually beyond Algebra 2, but sometimes you can understand how to use the methods even if you couldn't discover such methods yourself.

POSTED BY: Bill Simpson
Reply to this discussion
Community posts can be styled and formatted using the Markdown syntax.
Reply Preview
Attachments
Remove
or Discard