Wayback Machine
MAY OCT Nov
Previous capture 10 Next capture
2007 2008 2009
2 captures
13 May 08 - 10 Oct 08
sparklines
Close Help

Applications

From The Crop Circle Ship Wiki

Jump to: navigation, search

[edit] Base 6 Number Converter

This small program will let you convert normal base 10 numbers to base 6. The program can also calculate prime numbers.

http://www.cropcircleship.com/supernumbers.exe

(Only 32KB)

If you prefer, you can copy the source code for Microsoft Visual Basic below. You should be able to easily modify it (change the 6's) to convert to other bases as well. (As long as letters aren't involved).


 Visual Basic Source Code
 'convert numbers to base 6
 'code by jeremy at cropcircleship com
 
 Public Function ConvertToBase6(ByVal numberToConvert As Integer) As String
     Dim fullS As String, n As Integer, tmpInt As Integer
     
     For n = 24 To 1 Step -1
         tmpInt = 0
 z:
         If numberToConvert > ((6 ^ n) - 1) Then
             tmpInt = tmpInt + 1
             numberToConvert = numberToConvert - (6 ^ n)
         End If
 
         If numberToConvert > ((6 ^ n) - 1) Then GoTo z
         
         fullS = fullS & Trim(Str(tmpInt))
     Next n
     
     ConvertToBase6 = Val(fullS & (numberToConvert Mod 6))
 End Function
 Usage
 'VARIABLE/PROPERTY = ConvertToBase6(YOURNUMBER)
Personal tools