Jump to content
BrainDen.com - Brain Teasers
  • 0

Shuffle to Double


TimeSpaceLightForce
 Share

Question

7 answers to this question

Recommended Posts

  • 0

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 by Pickett
Link to comment
Share on other sites

  • 0

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..

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Answer this question...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Loading...
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...