How do you find the number of primes in a sequence up to the first thousand terms?

The name of the pictureThe name of the pictureThe name of the pictureClash Royale CLAN TAG#URR8PPP











up vote
-2
down vote

favorite












I have a sequence:



$ 7,19,61,193,577,1633,4417, ... $



and I'd like to find out how many primes and semiprimes there are in this sequence up to the first thousand terms? Any idea how I could do that quickly?



To form the sequence I did: $ 3(2)+1, 6(3)+1, 12(5)+1, 24(8)+1, 48(12)+1, 96(17)+1, ... $



i.e. : $ 3+3+1, 6+6+6+1, 12+12+12+12+12+1, ... $







share|cite|improve this question





















  • Well I took 3,3,1 and then 6,6,6,1, and then 12,12,12,12,12,1 etc. so the 2,3,5,12,17 are the number of times you multiply the 3, 6, 12, etc.
    – George Thomas
    Jul 22 at 23:24










  • If $t_n$ is the $n$th triangular number, then a formula for the sequence is $a_n = 3cdot 2^n-1(2+t_n-1)+1$ and we know that $t_n = n(n+1)/2.$
    – B. Goddard
    Jul 22 at 23:26











  • So this is a triangular sequence you're saying?
    – George Thomas
    Jul 22 at 23:29










  • No. The triangular numbers come into the formula. If you simplify my calculations you get $a_n = 3cdot 2^n-2(n^2-n+4) +1.$ It's easy to write a quick loop in Maple and get the list that Robert gets below.
    – B. Goddard
    Jul 22 at 23:33














up vote
-2
down vote

favorite












I have a sequence:



$ 7,19,61,193,577,1633,4417, ... $



and I'd like to find out how many primes and semiprimes there are in this sequence up to the first thousand terms? Any idea how I could do that quickly?



To form the sequence I did: $ 3(2)+1, 6(3)+1, 12(5)+1, 24(8)+1, 48(12)+1, 96(17)+1, ... $



i.e. : $ 3+3+1, 6+6+6+1, 12+12+12+12+12+1, ... $







share|cite|improve this question





















  • Well I took 3,3,1 and then 6,6,6,1, and then 12,12,12,12,12,1 etc. so the 2,3,5,12,17 are the number of times you multiply the 3, 6, 12, etc.
    – George Thomas
    Jul 22 at 23:24










  • If $t_n$ is the $n$th triangular number, then a formula for the sequence is $a_n = 3cdot 2^n-1(2+t_n-1)+1$ and we know that $t_n = n(n+1)/2.$
    – B. Goddard
    Jul 22 at 23:26











  • So this is a triangular sequence you're saying?
    – George Thomas
    Jul 22 at 23:29










  • No. The triangular numbers come into the formula. If you simplify my calculations you get $a_n = 3cdot 2^n-2(n^2-n+4) +1.$ It's easy to write a quick loop in Maple and get the list that Robert gets below.
    – B. Goddard
    Jul 22 at 23:33












up vote
-2
down vote

favorite









up vote
-2
down vote

favorite











I have a sequence:



$ 7,19,61,193,577,1633,4417, ... $



and I'd like to find out how many primes and semiprimes there are in this sequence up to the first thousand terms? Any idea how I could do that quickly?



To form the sequence I did: $ 3(2)+1, 6(3)+1, 12(5)+1, 24(8)+1, 48(12)+1, 96(17)+1, ... $



i.e. : $ 3+3+1, 6+6+6+1, 12+12+12+12+12+1, ... $







share|cite|improve this question













I have a sequence:



$ 7,19,61,193,577,1633,4417, ... $



and I'd like to find out how many primes and semiprimes there are in this sequence up to the first thousand terms? Any idea how I could do that quickly?



To form the sequence I did: $ 3(2)+1, 6(3)+1, 12(5)+1, 24(8)+1, 48(12)+1, 96(17)+1, ... $



i.e. : $ 3+3+1, 6+6+6+1, 12+12+12+12+12+1, ... $









share|cite|improve this question












share|cite|improve this question




share|cite|improve this question








edited Jul 22 at 23:27
























asked Jul 22 at 23:20









George Thomas

269416




269416











  • Well I took 3,3,1 and then 6,6,6,1, and then 12,12,12,12,12,1 etc. so the 2,3,5,12,17 are the number of times you multiply the 3, 6, 12, etc.
    – George Thomas
    Jul 22 at 23:24










  • If $t_n$ is the $n$th triangular number, then a formula for the sequence is $a_n = 3cdot 2^n-1(2+t_n-1)+1$ and we know that $t_n = n(n+1)/2.$
    – B. Goddard
    Jul 22 at 23:26











  • So this is a triangular sequence you're saying?
    – George Thomas
    Jul 22 at 23:29










  • No. The triangular numbers come into the formula. If you simplify my calculations you get $a_n = 3cdot 2^n-2(n^2-n+4) +1.$ It's easy to write a quick loop in Maple and get the list that Robert gets below.
    – B. Goddard
    Jul 22 at 23:33
















  • Well I took 3,3,1 and then 6,6,6,1, and then 12,12,12,12,12,1 etc. so the 2,3,5,12,17 are the number of times you multiply the 3, 6, 12, etc.
    – George Thomas
    Jul 22 at 23:24










  • If $t_n$ is the $n$th triangular number, then a formula for the sequence is $a_n = 3cdot 2^n-1(2+t_n-1)+1$ and we know that $t_n = n(n+1)/2.$
    – B. Goddard
    Jul 22 at 23:26











  • So this is a triangular sequence you're saying?
    – George Thomas
    Jul 22 at 23:29










  • No. The triangular numbers come into the formula. If you simplify my calculations you get $a_n = 3cdot 2^n-2(n^2-n+4) +1.$ It's easy to write a quick loop in Maple and get the list that Robert gets below.
    – B. Goddard
    Jul 22 at 23:33















Well I took 3,3,1 and then 6,6,6,1, and then 12,12,12,12,12,1 etc. so the 2,3,5,12,17 are the number of times you multiply the 3, 6, 12, etc.
– George Thomas
Jul 22 at 23:24




Well I took 3,3,1 and then 6,6,6,1, and then 12,12,12,12,12,1 etc. so the 2,3,5,12,17 are the number of times you multiply the 3, 6, 12, etc.
– George Thomas
Jul 22 at 23:24












If $t_n$ is the $n$th triangular number, then a formula for the sequence is $a_n = 3cdot 2^n-1(2+t_n-1)+1$ and we know that $t_n = n(n+1)/2.$
– B. Goddard
Jul 22 at 23:26





If $t_n$ is the $n$th triangular number, then a formula for the sequence is $a_n = 3cdot 2^n-1(2+t_n-1)+1$ and we know that $t_n = n(n+1)/2.$
– B. Goddard
Jul 22 at 23:26













So this is a triangular sequence you're saying?
– George Thomas
Jul 22 at 23:29




So this is a triangular sequence you're saying?
– George Thomas
Jul 22 at 23:29












No. The triangular numbers come into the formula. If you simplify my calculations you get $a_n = 3cdot 2^n-2(n^2-n+4) +1.$ It's easy to write a quick loop in Maple and get the list that Robert gets below.
– B. Goddard
Jul 22 at 23:33




No. The triangular numbers come into the formula. If you simplify my calculations you get $a_n = 3cdot 2^n-2(n^2-n+4) +1.$ It's easy to write a quick loop in Maple and get the list that Robert gets below.
– B. Goddard
Jul 22 at 23:33










1 Answer
1






active

oldest

votes

















up vote
4
down vote



accepted










There are $24$ primes in the first $1000$ terms, namely terms number
$$1, 2, 3, 4, 5, 12, 21, 23, 24, 27, 46, 47, 48, 50, 54, 65, 68, 101, 159, 286, 483, 572, 802, 873$$



There's no shortcut, just generate the terms and test for primality.
Fortunately, that's quite fast. In Maple on my computer it took less than half a second.



Counting the semiprimes would be harder, I think, because I don't know of a way to test for semiprimes that's much faster than factoring, and the $1000$'th term has $307$ digits - no picnic to factor.






share|cite|improve this answer























  • I'm sorry I don't understand this
    – George Thomas
    Jul 22 at 23:31










  • What part don't you understand?
    – Robert Israel
    Jul 22 at 23:33










  • What are the numbers you listed?
    – George Thomas
    Jul 22 at 23:36










  • Oh are those the terms in the sequence that yield primes?
    – George Thomas
    Jul 22 at 23:39






  • 1




    Ah I see that it's the law of small numbers taking effect here
    – George Thomas
    Jul 22 at 23:56










Your Answer




StackExchange.ifUsing("editor", function ()
return StackExchange.using("mathjaxEditing", function ()
StackExchange.MarkdownEditor.creationCallbacks.add(function (editor, postfix)
StackExchange.mathjaxEditing.prepareWmdForMathJax(editor, postfix, [["$", "$"], ["\\(","\\)"]]);
);
);
, "mathjax-editing");

StackExchange.ready(function()
var channelOptions =
tags: "".split(" "),
id: "69"
;
initTagRenderer("".split(" "), "".split(" "), channelOptions);

StackExchange.using("externalEditor", function()
// Have to fire editor after snippets, if snippets enabled
if (StackExchange.settings.snippets.snippetsEnabled)
StackExchange.using("snippets", function()
createEditor();
);

else
createEditor();

);

function createEditor()
StackExchange.prepareEditor(
heartbeatType: 'answer',
convertImagesToLinks: true,
noModals: false,
showLowRepImageUploadWarning: true,
reputationToPostImages: 10,
bindNavPrevention: true,
postfix: "",
noCode: true, onDemand: true,
discardSelector: ".discard-answer"
,immediatelyShowMarkdownHelp:true
);



);








 

draft saved


draft discarded


















StackExchange.ready(
function ()
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fmath.stackexchange.com%2fquestions%2f2859864%2fhow-do-you-find-the-number-of-primes-in-a-sequence-up-to-the-first-thousand-term%23new-answer', 'question_page');

);

Post as a guest






























1 Answer
1






active

oldest

votes








1 Answer
1






active

oldest

votes









active

oldest

votes






active

oldest

votes








up vote
4
down vote



accepted










There are $24$ primes in the first $1000$ terms, namely terms number
$$1, 2, 3, 4, 5, 12, 21, 23, 24, 27, 46, 47, 48, 50, 54, 65, 68, 101, 159, 286, 483, 572, 802, 873$$



There's no shortcut, just generate the terms and test for primality.
Fortunately, that's quite fast. In Maple on my computer it took less than half a second.



Counting the semiprimes would be harder, I think, because I don't know of a way to test for semiprimes that's much faster than factoring, and the $1000$'th term has $307$ digits - no picnic to factor.






share|cite|improve this answer























  • I'm sorry I don't understand this
    – George Thomas
    Jul 22 at 23:31










  • What part don't you understand?
    – Robert Israel
    Jul 22 at 23:33










  • What are the numbers you listed?
    – George Thomas
    Jul 22 at 23:36










  • Oh are those the terms in the sequence that yield primes?
    – George Thomas
    Jul 22 at 23:39






  • 1




    Ah I see that it's the law of small numbers taking effect here
    – George Thomas
    Jul 22 at 23:56














up vote
4
down vote



accepted










There are $24$ primes in the first $1000$ terms, namely terms number
$$1, 2, 3, 4, 5, 12, 21, 23, 24, 27, 46, 47, 48, 50, 54, 65, 68, 101, 159, 286, 483, 572, 802, 873$$



There's no shortcut, just generate the terms and test for primality.
Fortunately, that's quite fast. In Maple on my computer it took less than half a second.



Counting the semiprimes would be harder, I think, because I don't know of a way to test for semiprimes that's much faster than factoring, and the $1000$'th term has $307$ digits - no picnic to factor.






share|cite|improve this answer























  • I'm sorry I don't understand this
    – George Thomas
    Jul 22 at 23:31










  • What part don't you understand?
    – Robert Israel
    Jul 22 at 23:33










  • What are the numbers you listed?
    – George Thomas
    Jul 22 at 23:36










  • Oh are those the terms in the sequence that yield primes?
    – George Thomas
    Jul 22 at 23:39






  • 1




    Ah I see that it's the law of small numbers taking effect here
    – George Thomas
    Jul 22 at 23:56












up vote
4
down vote



accepted







up vote
4
down vote



accepted






There are $24$ primes in the first $1000$ terms, namely terms number
$$1, 2, 3, 4, 5, 12, 21, 23, 24, 27, 46, 47, 48, 50, 54, 65, 68, 101, 159, 286, 483, 572, 802, 873$$



There's no shortcut, just generate the terms and test for primality.
Fortunately, that's quite fast. In Maple on my computer it took less than half a second.



Counting the semiprimes would be harder, I think, because I don't know of a way to test for semiprimes that's much faster than factoring, and the $1000$'th term has $307$ digits - no picnic to factor.






share|cite|improve this answer















There are $24$ primes in the first $1000$ terms, namely terms number
$$1, 2, 3, 4, 5, 12, 21, 23, 24, 27, 46, 47, 48, 50, 54, 65, 68, 101, 159, 286, 483, 572, 802, 873$$



There's no shortcut, just generate the terms and test for primality.
Fortunately, that's quite fast. In Maple on my computer it took less than half a second.



Counting the semiprimes would be harder, I think, because I don't know of a way to test for semiprimes that's much faster than factoring, and the $1000$'th term has $307$ digits - no picnic to factor.







share|cite|improve this answer















share|cite|improve this answer



share|cite|improve this answer








edited Jul 22 at 23:37


























answered Jul 22 at 23:29









Robert Israel

304k22201441




304k22201441











  • I'm sorry I don't understand this
    – George Thomas
    Jul 22 at 23:31










  • What part don't you understand?
    – Robert Israel
    Jul 22 at 23:33










  • What are the numbers you listed?
    – George Thomas
    Jul 22 at 23:36










  • Oh are those the terms in the sequence that yield primes?
    – George Thomas
    Jul 22 at 23:39






  • 1




    Ah I see that it's the law of small numbers taking effect here
    – George Thomas
    Jul 22 at 23:56
















  • I'm sorry I don't understand this
    – George Thomas
    Jul 22 at 23:31










  • What part don't you understand?
    – Robert Israel
    Jul 22 at 23:33










  • What are the numbers you listed?
    – George Thomas
    Jul 22 at 23:36










  • Oh are those the terms in the sequence that yield primes?
    – George Thomas
    Jul 22 at 23:39






  • 1




    Ah I see that it's the law of small numbers taking effect here
    – George Thomas
    Jul 22 at 23:56















I'm sorry I don't understand this
– George Thomas
Jul 22 at 23:31




I'm sorry I don't understand this
– George Thomas
Jul 22 at 23:31












What part don't you understand?
– Robert Israel
Jul 22 at 23:33




What part don't you understand?
– Robert Israel
Jul 22 at 23:33












What are the numbers you listed?
– George Thomas
Jul 22 at 23:36




What are the numbers you listed?
– George Thomas
Jul 22 at 23:36












Oh are those the terms in the sequence that yield primes?
– George Thomas
Jul 22 at 23:39




Oh are those the terms in the sequence that yield primes?
– George Thomas
Jul 22 at 23:39




1




1




Ah I see that it's the law of small numbers taking effect here
– George Thomas
Jul 22 at 23:56




Ah I see that it's the law of small numbers taking effect here
– George Thomas
Jul 22 at 23:56












 

draft saved


draft discarded


























 


draft saved


draft discarded














StackExchange.ready(
function ()
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fmath.stackexchange.com%2fquestions%2f2859864%2fhow-do-you-find-the-number-of-primes-in-a-sequence-up-to-the-first-thousand-term%23new-answer', 'question_page');

);

Post as a guest













































































Comments

Popular posts from this blog

What is the equation of a 3D cone with generalised tilt?

Color the edges and diagonals of a regular polygon

Relationship between determinant of matrix and determinant of adjoint?