' A number with odd number of digits and zero in the center is cyclops number
Imports System
Public Class Program
Private Shared Function isCyclopsNumber(ByVal n As Integer) As Boolean
If n = 0 Then
Return True
End If
Dim m As Integer = n Mod 10
Dim count As Integer = 0
While m <> 0
count += 1
n = n / 10
m = n Mod 10
End While
n = n / 10
m = n Mod 10
While m <> 0
count -= 1
n = n / 10
m = n Mod 10
End While
Return n = 0 AndAlso count = 0
End Function
Private Shared Function isPrime(ByVal n As Integer) As Boolean
If n < 2 OrElse (n Mod 2 = 0 AndAlso n <> 2) Then
Return False
End If
Dim count As Integer = CInt(Math.Floor(Math.Sqrt(n)))
For i As Integer = 3 To count Step 2
If n Mod i = 0 Then
Return False
End If
Next
Return True
End Function
Public Shared Sub Main(ByVal args As String())
Dim n As Integer = 209
Console.WriteLine(If(isCyclopsNumber(n) AndAlso isPrime(n), "yes", "no"))
n = 503
Console.WriteLine((If(isCyclopsNumber(n) AndAlso isPrime(n), "yes", "no")))
End Sub
End Class
' run:
'
' no
' yes
'