How to print prime numbers between 1 to 50? [duplicate]

Clash Royale CLAN TAG#URR8PPP
up vote
1
down vote
favorite
This question already has an answer here:
Simple bash script to print prime numbers from 1 to 1000 [closed]
1 answer
for i in `seq 1 1 50`
do
for j in `seq 2 1 $i`
do
if [ `expr i % j` -eq 0 ]
then exit
elif [ $i -eq `expr j+1` ]
then echo "$i"
fi
done
done
I tried this. But it's not working
shell-script linux-mint
New contributor
Vraj Kotwala is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.
marked as duplicate by steve, Jeff Schaller, Stéphane Chazelas
StackExchange.ready(function()
if (StackExchange.options.isMobile) return;
$('.dupe-hammer-message-hover:not(.hover-bound)').each(function()
var $hover = $(this).addClass('hover-bound'),
$msg = $hover.siblings('.dupe-hammer-message');
$hover.hover(
function()
$hover.showInfoMessage('',
messageElement: $msg.clone().show(),
transient: false,
position: my: 'bottom left', at: 'top center', offsetTop: -7 ,
dismissable: false,
relativeToBody: true
);
,
function()
StackExchange.helpers.removeMessages();
);
);
);
16 mins ago
This question has been asked before and already has an answer. If those answers do not fully address your question, please ask a new question.
add a comment |Â
up vote
1
down vote
favorite
This question already has an answer here:
Simple bash script to print prime numbers from 1 to 1000 [closed]
1 answer
for i in `seq 1 1 50`
do
for j in `seq 2 1 $i`
do
if [ `expr i % j` -eq 0 ]
then exit
elif [ $i -eq `expr j+1` ]
then echo "$i"
fi
done
done
I tried this. But it's not working
shell-script linux-mint
New contributor
Vraj Kotwala is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.
marked as duplicate by steve, Jeff Schaller, Stéphane Chazelas
StackExchange.ready(function()
if (StackExchange.options.isMobile) return;
$('.dupe-hammer-message-hover:not(.hover-bound)').each(function()
var $hover = $(this).addClass('hover-bound'),
$msg = $hover.siblings('.dupe-hammer-message');
$hover.hover(
function()
$hover.showInfoMessage('',
messageElement: $msg.clone().show(),
transient: false,
position: my: 'bottom left', at: 'top center', offsetTop: -7 ,
dismissable: false,
relativeToBody: true
);
,
function()
StackExchange.helpers.removeMessages();
);
);
);
16 mins ago
This question has been asked before and already has an answer. If those answers do not fully address your question, please ask a new question.
1
echo '2 3 5 7 11 13 17 19 23 29 31 37 41 43 47'would be the most efficient.
â Stéphane Chazelas
14 mins ago
add a comment |Â
up vote
1
down vote
favorite
up vote
1
down vote
favorite
This question already has an answer here:
Simple bash script to print prime numbers from 1 to 1000 [closed]
1 answer
for i in `seq 1 1 50`
do
for j in `seq 2 1 $i`
do
if [ `expr i % j` -eq 0 ]
then exit
elif [ $i -eq `expr j+1` ]
then echo "$i"
fi
done
done
I tried this. But it's not working
shell-script linux-mint
New contributor
Vraj Kotwala is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.
This question already has an answer here:
Simple bash script to print prime numbers from 1 to 1000 [closed]
1 answer
for i in `seq 1 1 50`
do
for j in `seq 2 1 $i`
do
if [ `expr i % j` -eq 0 ]
then exit
elif [ $i -eq `expr j+1` ]
then echo "$i"
fi
done
done
I tried this. But it's not working
This question already has an answer here:
Simple bash script to print prime numbers from 1 to 1000 [closed]
1 answer
shell-script linux-mint
shell-script linux-mint
New contributor
Vraj Kotwala is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.
New contributor
Vraj Kotwala is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.
New contributor
Vraj Kotwala is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.
asked 21 mins ago
Vraj Kotwala
62
62
New contributor
Vraj Kotwala is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.
New contributor
Vraj Kotwala is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.
Vraj Kotwala is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.
marked as duplicate by steve, Jeff Schaller, Stéphane Chazelas
StackExchange.ready(function()
if (StackExchange.options.isMobile) return;
$('.dupe-hammer-message-hover:not(.hover-bound)').each(function()
var $hover = $(this).addClass('hover-bound'),
$msg = $hover.siblings('.dupe-hammer-message');
$hover.hover(
function()
$hover.showInfoMessage('',
messageElement: $msg.clone().show(),
transient: false,
position: my: 'bottom left', at: 'top center', offsetTop: -7 ,
dismissable: false,
relativeToBody: true
);
,
function()
StackExchange.helpers.removeMessages();
);
);
);
16 mins ago
This question has been asked before and already has an answer. If those answers do not fully address your question, please ask a new question.
marked as duplicate by steve, Jeff Schaller, Stéphane Chazelas
StackExchange.ready(function()
if (StackExchange.options.isMobile) return;
$('.dupe-hammer-message-hover:not(.hover-bound)').each(function()
var $hover = $(this).addClass('hover-bound'),
$msg = $hover.siblings('.dupe-hammer-message');
$hover.hover(
function()
$hover.showInfoMessage('',
messageElement: $msg.clone().show(),
transient: false,
position: my: 'bottom left', at: 'top center', offsetTop: -7 ,
dismissable: false,
relativeToBody: true
);
,
function()
StackExchange.helpers.removeMessages();
);
);
);
16 mins ago
This question has been asked before and already has an answer. If those answers do not fully address your question, please ask a new question.
1
echo '2 3 5 7 11 13 17 19 23 29 31 37 41 43 47'would be the most efficient.
â Stéphane Chazelas
14 mins ago
add a comment |Â
1
echo '2 3 5 7 11 13 17 19 23 29 31 37 41 43 47'would be the most efficient.
â Stéphane Chazelas
14 mins ago
1
1
echo '2 3 5 7 11 13 17 19 23 29 31 37 41 43 47' would be the most efficient.â Stéphane Chazelas
14 mins ago
echo '2 3 5 7 11 13 17 19 23 29 31 37 41 43 47' would be the most efficient.â Stéphane Chazelas
14 mins ago
add a comment |Â
1 Answer
1
active
oldest
votes
up vote
0
down vote
Duplicate of an existing answer, but essentially just use factor 1..50|awk 'NF==2print $2'
add a comment |Â
1 Answer
1
active
oldest
votes
1 Answer
1
active
oldest
votes
active
oldest
votes
active
oldest
votes
up vote
0
down vote
Duplicate of an existing answer, but essentially just use factor 1..50|awk 'NF==2print $2'
add a comment |Â
up vote
0
down vote
Duplicate of an existing answer, but essentially just use factor 1..50|awk 'NF==2print $2'
add a comment |Â
up vote
0
down vote
up vote
0
down vote
Duplicate of an existing answer, but essentially just use factor 1..50|awk 'NF==2print $2'
Duplicate of an existing answer, but essentially just use factor 1..50|awk 'NF==2print $2'
answered 16 mins ago
steve
13.4k22251
13.4k22251
add a comment |Â
add a comment |Â
1
echo '2 3 5 7 11 13 17 19 23 29 31 37 41 43 47'would be the most efficient.â Stéphane Chazelas
14 mins ago