Skip to content

Instantly share code, notes, and snippets.

@bobixaka
Created September 8, 2013 21:27
Show Gist options
  • Save bobixaka/6488551 to your computer and use it in GitHub Desktop.
Save bobixaka/6488551 to your computer and use it in GitHub Desktop.
This is a strange numeral system which consists of 256 elements, represented by combinations of letters. 0 - 'A'; 1 - 'B'; ... 234 - "iA"; 235 - "iB"; ... 255 - "iV" The code converts a decimal (decimal based numeral system) to a Kaspichan Numeral system (strange system)
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace KaspichanNumbers
{
class KaspichanNumbers
{
static void Main()
{
ulong InputNumber = ulong.Parse(Console.ReadLine());
List<string> Kaspichan = new List<string>();
List<string> OutputNumber = new List<string>();
for (char i = 'A'; i <= 'Z'; i++)
{
Kaspichan.Add(i.ToString());
}
char EndChar = 'Z';
for (char i = 'a'; i <= 'i'; i++)
{
if (i == 'i')
{
EndChar = 'V';
}
for (char j = 'A'; j <= EndChar; j++)
{
Kaspichan.Add(i.ToString() + j.ToString());
}
}
while (InputNumber > 0)
{
ulong Remainder = InputNumber % 256;
InputNumber /= 256;
OutputNumber.Add(Kaspichan[(int)Remainder]);
}
OutputNumber.Reverse();
foreach (var number in OutputNumber)
{
Console.Write(number);
}
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment