include "inc/cmdsys.plh"

var a, b, i,loprim,hiprim

def getnum
    var str, num
    num = 0
    str = gets(':'|$80) + 1
    while ^str >= '0' and ^str <= '9'
        num = num * 10 + (^str - '0')
        str++
    loop
    return num
end

def prim(x)
    var i
    i = 3
    while i*i < x and x % i; i = i + 2; loop
    return x < i*i
end

puts("Geben Sie den oberen Grenzwert ein")
a = getnum
puts("Geben Sie die minimale Differenz ein")
b = getnum
loprim, hiprim, i = 1, 1, 3
while i <= a and hiprim-loprim < b
    if prim(i)
        loprim = hiprim
        hiprim = i
    fin
    i = i + 2
loop
if hiprim-loprim < b
    puts("keine Loesung gefunden !")
else
    puti(hiprim); putc(' '); puti(loprim); putc(' '); puti(hiprim-loprim)
fin
putln
done
