80 lines
1.6 KiB
Plaintext
80 lines
1.6 KiB
Plaintext
DisableDebugger
|
|
EnableExplicit
|
|
|
|
#LIM=1000035
|
|
|
|
Macro six(mul)
|
|
6*mul
|
|
EndMacro
|
|
|
|
Macro form(n)
|
|
RSet(Str(n),8)
|
|
EndMacro
|
|
|
|
Macro put(m,g,n)
|
|
PrintN(Str(m)+" "+g)
|
|
PrintN(n)
|
|
EndMacro
|
|
|
|
Define c1.i=2,c2.i,c3.i,c4.i,c5.i,t1$,t2$,t3$,t4$,t5$,i.i,j.i
|
|
|
|
Global Dim soe.b(#LIM)
|
|
FillMemory(@soe(0),#LIM,#True,#PB_Byte)
|
|
If Not OpenConsole("")
|
|
End 1
|
|
EndIf
|
|
|
|
For i=2 To Sqr(#LIM)
|
|
If soe(i)=#True
|
|
j=i*i
|
|
While j<=#LIM
|
|
soe(j)=#False
|
|
j+i
|
|
Wend
|
|
EndIf
|
|
Next
|
|
|
|
Procedure.s formtab(t$,l.i)
|
|
If CountString(t$,~"\n")>l
|
|
t$=Mid(t$,FindString(t$,~"\n")+1)
|
|
EndIf
|
|
ProcedureReturn t$
|
|
EndProcedure
|
|
|
|
For i=3 To #LIM Step 2
|
|
If i>5 And i<#LIM-6 And soe(i)&~(soe(i-six(1))|soe(i+six(1)))
|
|
c1+1
|
|
t1$+form(i)+~"\n"
|
|
t1$=formtab(t1$,10)
|
|
Continue
|
|
EndIf
|
|
If i<#LIM-six(1) And soe(i)&soe(i+six(1))
|
|
c2+1
|
|
t2$+form(i)+form(i+six(1))+~"\n"
|
|
t2$=formtab(t2$,5)
|
|
EndIf
|
|
If i<#LIM-six(2) And soe(i)&soe(i+six(1))&soe(i+six(2))
|
|
c3+1
|
|
t3$+form(i)+form(i+six(1))+form(i+six(2))+~"\n"
|
|
t3$=formtab(t3$,5)
|
|
EndIf
|
|
If i<#LIM-six(3) And soe(i)&soe(i+six(1))&soe(i+six(2))&soe(i+six(3))
|
|
c4+1
|
|
t4$+form(i)+form(i+six(1))+form(i+six(2))+form(i+six(3))+~"\n"
|
|
t4$=formtab(t4$,5)
|
|
EndIf
|
|
If i<#LIM-six(4) And soe(i)&soe(i+six(1))&soe(i+six(2))&soe(i+six(3))&soe(i+six(4))
|
|
c5+1
|
|
t5$+form(i)+form(i+six(1))+form(i+six(2))+form(i+six(3))+form(i+six(4))+~"\n"
|
|
t5$=formtab(t5$,5)
|
|
EndIf
|
|
Next
|
|
|
|
put(c2,"pairs ending with ...",t2$)
|
|
put(c3,"triplets ending with ...",t3$)
|
|
put(c4,"quadruplets ending with ...",t4$)
|
|
put(c5,"quintuplets ending with ...",t5$)
|
|
put(c1,"unsexy primes ending with ...",t1$)
|
|
|
|
Input()
|