30 lines
586 B
Text
30 lines
586 B
Text
#include "isprime.bas"
|
|
#include "sort.bas"
|
|
|
|
Dim As Integer i, n, tmp, num, cant = 0
|
|
Dim Shared As Integer matriz(512)
|
|
For i = 0 To Ubound(matriz)-1
|
|
n = 0
|
|
tmp = i
|
|
num = 1
|
|
While tmp
|
|
If tmp And 1 Then n = n * 10 + num
|
|
tmp Shr= 1
|
|
num += 1
|
|
Wend
|
|
matriz(i)= n
|
|
Next i
|
|
|
|
Sort(matriz())
|
|
|
|
For i = 1 To Ubound(matriz)-1 'skip empty set
|
|
n = matriz(i)
|
|
If isPrime(n) Then
|
|
Print Using "#########"; n;
|
|
cant += 1
|
|
If cant Mod 10 = 0 Then Print
|
|
End If
|
|
Next i
|
|
Print Using !"\nThere are & ascending primes."; cant
|
|
|
|
Sleep
|