After two tries it was obvious that all possible answers to the question "What do you get if you choose any two digit number, add both digits then subtract from the original?" were given the same symbol so it didn't matter which two digit number you picked. The answer would always be one of the series The real problem, of course, is deriving the formula for this if one exists (given that it would be trivial to brute force this). Anyone game for that?

The code below reveals an interesting characteristic about the numbers. Think lives of a cat.

using System;
using System.Collections;


public class Sample
  {
    public static void Main(){

      ArrayList list = new ArrayList();

      for(int i = 10; i <100; i++){ <br>     int j = doMagic(i);

    if(!list.Contains(j)){
      list.Add(j);    
    }
      }

      list.Sort();


      //print all possible numbers that satisfy criteria
      foreach(int i in list){
    Console.WriteLine(i);
      }

    }

    static int firstDigit(int num){  return num/10;}

    static int secondDigit(int num){  return num%10;}
   
    static int doMagic(int number){

      return number - (firstDigit(number) + secondDigit(number));

    }

}


 

Categories: