Find palindromic numbers in both binary and ternary bases

You are encouraged to solve this task according to the task description, using any language you may know.
Task

   Find and show (in decimal) the first six numbers (non-negative integers) that are   palindromes   in   both:
   base 2
   base 3
   Display   0   (zero) as the first number found, even though some other definitions ignore it.
   Optionally, show the decimal number found in its binary and ternary form.
   Show all output here.


It's permissible to assume the first two numbers and simply list them.



See also
   Sequence A60792,   numbers that are palindromic in bases 2 and 3 on The On-Line Encyclopedia of Integer Sequences.


' FB 1.05.0 Win64
 
'converts decimal "n" to its ternary equivalent
Function Ter(n As UInteger) As String
  If n = 0 Then Return "0"
  Dim result As String = ""
  While n > 0
    result = (n Mod 3) & result
    n \= 3
  Wend
  Return result
End Function
 
' check if a binary or ternary numeric string "s" is palindromic
Function isPalindromic(s As String) As Boolean
  ' we can assume "s" will have an odd number of digits, so can ignore the middle digit
  Dim As UInteger length = Len(s)
  For i As UInteger = 0 To length \ 2 - 1
    If s[i] <> s[length - 1 - i] Then Return False
  Next
  Return True
End Function
 
' print a number which is both a binary and ternary palindrome in all three bases
Sub printPalindrome(n As UInteger)
  Print "Decimal : "; Str(n)
  Print "Binary  : "; bin(n)
  Print "Ternary : "; ter(n)
  Print
End Sub
 
' create a ternary palindrome whose left part is the ternary equivalent of "n" and return its decimal equivalent
Function createPalindrome3(n As UInteger) As UInteger
  Dim As String ternary = Ter(n)
  Dim As UInteger power3 = 1, sum = 0, length = Len(ternary)
  For i As Integer = 0 To Length - 1 ''right part of palindrome is mirror image of left part
    If ternary[i] > 48 Then  '' i.e. non-zero
      sum += (ternary[i] - 48) * power3
    End If
    power3 *= 3
  Next
  sum += power3 '' middle digit must be 1
  power3 *= 3
  sum += n * power3  '' value of left part is simply "n" multiplied by appropriate power of 3
  Return sum
End Function
 
Dim t As Double = timer
Dim As UInteger i = 1, p3, count = 2
Dim As String binStr
Print "The first 6 numbers which are palindromic in both binary and ternary are :"
Print
' we can assume the first two palindromic numbers as per the task description
printPalindrome(0) '' 0 is a palindrome in all 3 bases
printPalindrome(1) '' 1 is a palindrome in all 3 bases
Do
  p3 = createPalindrome3(i)
  If p3 Mod 2 > 0 Then ' cannot be even as binary equivalent would end in zero
    binStr = Bin(p3)  '' Bin function is built into FB
    If Len(binStr) Mod 2 = 1 Then  '' binary palindrome must have an odd number of digits
      If isPalindromic(binStr) Then
        printPalindrome(p3)
        count += 1
      End If
    End If
  End If
  i += 1
Loop Until count = 6
Print "Took ";
Print Using "#.###"; timer - t;
Print " seconds on i3 @ 2.13 GHz"
Print "Press any key to quit"
Sleep