A Programming Excercise

By Daniel Miessler on October 11th, 2005: Tagged as Programming | Python
  • Carl M

    If I am reading your code correctly, it finds ONE magic number for each of the numbers from 2 to 9. (This is in fact what the instructions required.) But, my question is: Are the answers unique? Extend that question a little bit … for an integer, i, from 1 to 9 (note that I started at 1), how many six digit numbers have the property that they are equal to their digit reversal when multiplied by i? PERHAPS the answer is that there is only one such six digit number for each of the numbers from 2 to 9, but there are certainly MANY when i=1. How many?

  • Carl M

    If I am reading your code correctly, it finds ONE magic number for each of the numbers from 2 to 9. (This is in fact what the instructions required.) But, my question is: Are the answers unique? Extend that question a little bit … for an integer, i, from 1 to 9 (note that I started at 1), how many six digit numbers have the property that they are equal to their digit reversal when multiplied by i? PERHAPS the answer is that there is only one such six digit number for each of the numbers from 2 to 9, but there are certainly MANY when i=1. How many?

  • http://kenswain.com/ Ken

    You comments are kinds D, but my code was getting complex fast. I think this is the most elegant solution to the problem.

    BTW I did find one piece on the challenge site that looked like mine in python, but was almost 40 lines when it was done. WAY TO GO DUDE!

  • http://kenswain.com Ken

    You comments are kinds D, but my code was getting complex fast. I think this is the most elegant solution to the problem.

    BTW I did find one piece on the challenge site that looked like mine in python, but was almost 40 lines when it was done. WAY TO GO DUDE!


Top

Popular

Information Security / Technology

Politics

Philosophy & Religion

Technology & Science

Culture & Society

Miscellaneous

Arguments

Projects

Collections

Twitter

What I'm Reading

Favorite Books and Essays

Top Blog Categories

Inputs