Guest Posted May 9, 2009 Report Share Posted May 9, 2009 Determine all possible positive palindrome(s) N, such that the decimal representation of 2N2 has no leading zeroes and contains each of the digits from 0 to 9 exactly once. Quote Link to comment Share on other sites More sharing options...
0 Pickett Posted May 11, 2009 Report Share Posted May 11, 2009 Determine all possible positive palindrome(s) N, such that the decimal representation of 2N2 has no leading zeroes and contains each of the digits from 0 to 9 exactly once. Here are the only 2 INTEGER solutions to this problem...I'm sure there are some decimal answers as well... 46464: 2(46464)2 = 4317806592 69696: 2(69696)2 = 9715064832 Which then you can just add decimal places to, to get some REAL solutions: 4.6464 46.464 464.64 4646.4 6.9696 69.696 696.96 6969.6...So, I will guess that that is all of them, (since the result of .46464 and .69696 have leading zeros in the answer. Quote Link to comment Share on other sites More sharing options...
0 Guest Posted May 11, 2009 Report Share Posted May 11, 2009 (edited) Here are the only 2 INTEGER solutions to this problem...I'm sure there are some decimal answers as well... 46464: 2(46464)2 = 4317806592 69696: 2(69696)2 = 9715064832 Which then you can just add decimal places to, to get some REAL solutions: 4.6464 46.464 464.64 4646.4 6.9696 69.696 696.96 6969.6...So, I will guess that that is all of them, (since the result of .46464 and .69696 have leading zeros in the answer. Indeed, 46464, 69696 are the only possible positive decimal palindromes that satisfy the given conditions. However, I do not know of an easy analytic method (and still looking for it) to substantiate this. Notes: 1. It may be observed that a palindrome is always an integer according to this mathworld article , unless stated otherwise. 2. According to wikipedia, decimal denotes base ten. In hindsight, I should have mentioned “base ten representation……” in the problem text rather than “decimal representation”. Edited May 11, 2009 by K Sengupta Quote Link to comment Share on other sites More sharing options...
0 Pickett Posted May 11, 2009 Report Share Posted May 11, 2009 Indeed, 46464, 69696 are the only possible positive decimal palindromes that satisfy the given conditions. However, I do not know of an easy analytic method (and still looking for it) to substantiate this. Notes: 1. It may be observed that a palindrome is always an integer according to this mathworld article , unless stated otherwise. 2. According to wikipedia, decimal denotes base ten. In hindsight, I should have mentioned “base ten representation……” in the problem text rather than “decimal representation”. I wrote a simple little program to solve this problem... And I knew the upper bound for the number was 70710, since any number greater than that would have more than 10 digits in the resulting answer (which invalidates the requirement that all numbers be present in answer)...same with the lower bound being 22360 (since the resulting number would have less than 10 digits). See the attached code: List<String> palindromes = getPalindromes(22360, 70710); for (int i = 0; i < palindromes.size(); i++) { Long l = Long.valueOf(palindromes.get(i)); Long newVal = 2 * (l * l); String newStr = newVal.toString(); boolean hasAll = true; for (int j = 0; j < 10; j++) { if (newStr.indexOf(Integer.toString(j)) < 0) { hasAll = false; break; } } if (hasAll) { System.out.println(l + ": (2 * " + l + " * " + l + ") = " + newStr); } } } private static List<String> getPalindromes(long lowerBound, long upperBound) { List<String> palindromes = new ArrayList<String>(); for (long i = lowerBound; i <= upperBound; i++) { String val = Long.toString(i); boolean isPal = true; for (int j = 0; j < val.length(); j++) { if (val.charAt(j) != val.charAt(val.length() - (j + 1))) { isPal = false; break; } } if (isPal) { palindromes.add(val); } } return palindromes; } public static void main(final String[] args) { Basically just get all numbers that are palindromes between those bounds, and then go through each of those palindromes, perform the operation, and check to make sure each resulting answer has every number. Fun problem, I enjoyed it. Quote Link to comment Share on other sites More sharing options...
Question
Guest
Determine all possible positive palindrome(s) N, such that the decimal representation of 2N2 has no leading zeroes and contains each of the digits from 0 to 9 exactly once.
Link to comment
Share on other sites
3 answers to this question
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.