BrainDen.com - Brain Teasers
• 0

# Shuffle to Double

Go to solution Solved by Pickett,

## Question

Search for the smallest positive integer that if you shuffle its digits its new value becomes double.

## Recommended Posts

• 0

Search for the smallest positive integer that if you shuffle its digits its new value becomes double.

0

##### Share on other sites
• 0

0 is not a positive integer.

24.

##### Share on other sites
• 0

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

##### Share on other sites
• 0

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"

##### Share on other sites
• 0

125874...can be shuffled to be 251748

##### Share on other sites
• 0
• Solution

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

## Join the conversation

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

×   Pasted as rich text.   Paste as plain text instead

Only 75 emoji are allowed.

×   Your previous content has been restored.   Clear editor

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