MC: Ping-Pong Cubes
|
05-25-2018, 11:45 PM
Post: #9
|
|||
|
|||
RE: MC: Ping-Pong Cubes
(05-25-2018 10:55 PM)ijabbott Wrote: I don't know if there is a clever trick to this problem (I can't think of one, but I'm not that clever!) or if it's just a brute force search. If the latter, it's not very interesting to me, There are many solutions (different approaches) for this problem and further there are two kinds of clever tricks which can be used to greatly decrease the search and/or the searching time: - on the one hand, you can avoid looping through every digit of a number to ascertain whether it's a PP or not. My solution above uses one such trick, as noted in the description, and not using loops greatly increases the speed there, almost linear time to check every number large or small. - on the other hand, you can avoid testing essentially 10\(^N\) N-digit numbers by using a clever but simple trick, reducing the search time by orders of magnitude. I've devised four or five different solutions using none, some or all of these techniques (the one above uses just the first kind) but they will be left an an exercise for the reader as I don't see much interest, if any, in HP-71B-coded solutions. Have a nice weekend. V. . All My Articles & other Materials here: Valentin Albillo's HP Collection |
|||
« Next Oldest | Next Newest »
|
User(s) browsing this thread: 6 Guest(s)