public static void Problem_36() { int Answer = 0; int Dec; string DecReversed = ""; char[] DecChars; char[] BinChars; string Bin; string BinReversed = ""; for (int i = 0; i < 1000000; i++) { Dec = i; DecChars = Dec.ToString().ToCharArray(); DecReversed = ""; for (int j = DecChars.Length - 1; j >= 0; j--) { DecReversed += DecChars[j]; } if (Dec == int.Parse(DecReversed)) { Bin = Convert.ToString(Dec, 2); BinReversed = ""; BinChars = Bin.ToCharArray(); for (int j = Bin.Length - 1; j >= 0; j--) { BinReversed += BinChars[j]; } if (Bin == BinReversed) { Answer += i; } } } Console.WriteLine("The sum of all circular primes is " + Answer); }
public void TestMethod1() { Angle Az, Ha, Dec; Angle LST = WiseSite.Instance.LocalSiderealTime; Ha = LST; Dec = Angle.FromDegrees(65, Angle.Type.Dec); Az = domeSlaveDriver.CalculateDomeAzimuth(Ha, Dec); Console.WriteLine(string.Format("{0}, {1} => {2}", Ha.ToString(), Dec.ToString(), Az.ToNiceString())); Ha = LST; Dec = Angle.FromDegrees(25, Angle.Type.Dec); Az = domeSlaveDriver.CalculateDomeAzimuth(Ha, Dec); Console.WriteLine(string.Format("{0}, {1} => {2}", Ha.ToString(), Dec.ToString(), Az.ToNiceString())); Ha = LST; Dec = Angle.FromDegrees(-15, Angle.Type.Dec); Az = domeSlaveDriver.CalculateDomeAzimuth(Ha, Dec); Console.WriteLine(string.Format("{0}, {1} => {2}", Ha.ToString(), Dec.ToString(), Az.ToNiceString())); Ha = LST; Dec = Angle.FromDegrees(0, Angle.Type.Dec); Az = domeSlaveDriver.CalculateDomeAzimuth(Ha, Dec); Console.WriteLine(string.Format("{0}, {1} => {2}", Ha.ToString(), Dec.ToString(), Az.ToNiceString())); Ha = LST + Angle.FromHours(4); Dec = Angle.FromRadians(0, Angle.Type.Dec); Az = domeSlaveDriver.CalculateDomeAzimuth(Ha, Dec); Console.WriteLine(string.Format("{0}, {1} => {2}", Ha.ToString(), Dec.ToString(), Az.ToNiceString())); Ha = Angle.FromHours(-3.25); Dec = Angle.FromRadians(0, Angle.Type.Dec); Az = domeSlaveDriver.CalculateDomeAzimuth(Ha, Dec); Console.WriteLine(string.Format("{0}, {1} => {2}", Ha.ToString(), Dec.ToString(), Az.ToNiceString())); }
public void DecToString() { var exp = new Dec(Variable.X); Assert.Equal("x--", exp.ToString(commoonFormatter)); }
override public String ToString() { return(HR_name + "," + Proper_name + String.Format(" RA:{0},Dec:{1},mag:{2}", RA.ToString(), Dec.ToString(), Magnitude.ToString())); }