TimeSpaceLightForce 12 Posted April 18, 2013 Report Share Posted April 18, 2013 Search for the smallest positive integer that if you shuffle its digits its new value becomes double. Quote Link to post Share on other sites
0 Solution Pickett 13 Posted April 18, 2013 Solution Report Share Posted April 18, 2013 (edited) Just validated my above answer with a simple program...in case you're curious, here's the source: public class SuffleDouble { public static void main(String[] args) { for (long i = 1; i < 1000000; i++) { permutation("", i + "", i); } } private static void permutation(String prefix, String str, long origVal) { int n = str.length(); if (n == 0) { long newVal = Long.parseLong(prefix); if (origVal * 2 == newVal) { System.out.println(origVal + " * 2 = " + prefix); System.exit(0); } } else { for (int i = 0; i < n; i++) { permutation(prefix + str.charAt(i), str.substring(0, i) + str.substring(i+1, n), origVal); } } } } Edited April 18, 2013 by Pickett Quote Link to post Share on other sites
0 BMAD 65 Posted April 18, 2013 Report Share Posted April 18, 2013 (edited) Search for the smallest positive integer that if you shuffle its digits its new value becomes double. 0 Edited April 18, 2013 by BMAD Quote Link to post Share on other sites
0 vinay.singh84 0 Posted April 18, 2013 Report Share Posted April 18, 2013 0 is not a positive integer. 24. Quote Link to post Share on other sites
0 BMAD 65 Posted April 18, 2013 Report Share Posted April 18, 2013 (edited) 0 is not a positive integer. 24. darn. This is why i prefer to write my own questions. I am always making simple mistakes like this. 42 is not double of 24 Edited April 18, 2013 by BMAD Quote Link to post Share on other sites
0 BMAD 65 Posted April 18, 2013 Report Share Posted April 18, 2013 Search for the smallest positive integer that if you shuffle its digits its new value becomes double. clarification is it going to be double regardless how it is shuffled or that there exists a double if shuffled the correct way" Quote Link to post Share on other sites
0 Pickett 13 Posted April 18, 2013 Report Share Posted April 18, 2013 125874...can be shuffled to be 251748 Quote Link to post Share on other sites
0 TimeSpaceLightForce 12 Posted April 19, 2013 Author Report Share Posted April 19, 2013 I was considering Kevink2's number 285714 from BMAD's 50% Increase problem to render 571428 , but hoping for much smaller number . Yet the 6 digits shows up again...."125874...can be shuffled to be 251748" matched with code. What other properties these 6digit combo has? Thanks for convincing solve Pickett.. Quote Link to post Share on other sites
Question
TimeSpaceLightForce 12
Search for the smallest positive integer that if you shuffle its digits its new value becomes double.
Link to post
Share on other sites
7 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.