Define dw15mk(c)=

Prgm

:If c<5 Then

:Disp "De kleinste priemtweeling is 3 en 5"

:Disp "Er is dus geen kleinste priemgetal onder ",c

:Disp "Probeer opnieuw!"

:Goto stopprogramma

:EndIf

:c-1→b

:For a,b,c

:a:=b-2

:If isPrime(a) and isPrime(b) Then

:Disp "Grootste priemtweeling onder ",c,"= ",a," &",b

:Goto stopprogramma

:EndIf

:b:=b-1

:EndFor

:Lbl stopprogramma

:EndPrgm

It works fine and communicates in dutch as well :)

]]>I'll try your code and will let you know. ]]>

Maybe this will work:

`Define grpr2 (n) Func Local n,b,c If n<5 Return {} {3,5}→c 7→b While b<n If isPrime(b) and isPrime (b-2) {b,b-2}→c b+6→b EndWhile Return c EndFunc`

I increment b by six each time since after the {3,5} pair, all twin primes are of the form {6k-1,6k+1}. I hope it works! Also, the NumTheory package might have a built in "nextPrime()" function which could speed up the process a bunch.

]]>I.e. if the number is 8 the program should return:

5, 7

I thought it should be something like this:

`Define grpr2(x)= Prgm If isPrime(x-1) -> a Then isPrime(x-3) -> b Else (x-1) -> x Endif Disp a, b EndPrgm`

Obviously I'm doing something wrong. I think it has to do with defining a and b, but I have no idea what. Can someone help me?

]]>