Properties
Similar Topics
Statistics
Comments
6
Participants
4
Subscribers
0
Votes
1
Views
2132
Share
Answered
I want to define n th. prime by using iteration command, For example Iteration[NextPrime[x],2,100] to see 101th. prime. Is iteration command limited to use with only mathematical functions?
- GeoGebra
- Help
- Partners
-
Contact us
- Feedback & Questions
- This email address is being protected from spambots. You need JavaScript enabled to view it.
- +43 677 6137 2693
© 2023 International GeoGebra Institute
Hi,
in GGB, 4 iterations are : f( f( f( f(x) ) ) )
try :
Sequence[NextPrime, i, 2, 100]
Sequence[NextPrime, i, 2, 100] command gives a list like {3,5,5,7,7,11,11,11,11,13,13,17,17,17...} because for i=4 it add list an element 5 and for 5 the same, so this command doesn't give 100th prime
:flushed:
try : with list1=Sequence[NextPrime, i, 2, 100]
Unique[list1]
or with just one command :
Unique[Sequence[NextPrime, i, 2, 100]]
Ok but this again doesn't give 100th prime gives 25th prime :)
Hi,
I guess
First[KeepIf[IsPrime[n],n,Sequence[1000]],100]
is the best option if you want to use commands. Number 1000 is a guess, it should be at least n*ln(n)*k where n is the number of primes you want to get and k is a suitable constant: https://en.wikipedia.org/wi...
Otherwise you can use spreadsheet
A1=2
A2=NextPrime[A1]
copy A2 down by dragging
Cheers,
Zbynek
Try playing with:
Unique[Sequence[NextPrime, i, 2, n (ln(n) + ln(ln(n)) - 1)]]
https://primes.utm.edu/howmany.html
Comments have been locked on this page!