Skip to main content
added 28 characters in body
Source Link
Justin
  • 21.3k
  • 9
  • 67
  • 114

Ruby, 7575 55 bytes

n=gets.to_i
a=[]
t=2
(a<<t if(2...t).all?{|i|t%i!=0}
t+=1)while !a[n-1]
p a
->n{a=[]
t=2
(a<<t if(2...t).all?{|i|t%i!=0}
t+=1)while !a[n-1]
a}

Works by trial division

Ruby, 75 bytes

n=gets.to_i
a=[]
t=2
(a<<t if(2...t).all?{|i|t%i!=0}
t+=1)while !a[n-1]
p a

Works by trial division

Ruby, 75 55 bytes

->n{a=[]
t=2
(a<<t if(2...t).all?{|i|t%i!=0}
t+=1)while !a[n-1]
a}

Works by trial division

Source Link
Justin
  • 21.3k
  • 9
  • 67
  • 114

Ruby, 75 bytes

n=gets.to_i
a=[]
t=2
(a<<t if(2...t).all?{|i|t%i!=0}
t+=1)while !a[n-1]
p a

Works by trial division