0

Working out the permutations by hand (I organized it by deciding where to put the 0's), I get 5 valid outcomes (out of 12 total = 3! * 2!) that are between 213 and 5127. I'm trying to figure out if I think of the numbers as symbols rather than numbers if there's a quicker way to do this (without actually listing them) for larger numbers such as 127 permutated between 4991829352 and 867557532895.

The bolded items meet the criteria

no zeros between them: 1600, 0160, 0016

one zero: 1060, 0106

two zeroes: 1006

no zeros between them: 6100, 0610, 0061

one zero 6010, 0601

two zeroes 6001

Zev
  • 103
  • 4
  • Incomprehensible. What do you mean by a "permutation of the number $16$"? – bof Oct 30 '17 at 06:01
  • @bof I provided an example of what I meant. Rearrangements of the digits 1 and 6 and any number of 0's such that the numeric value of the resulting arrangements are between 213 and 5127. I am trying to find how many numbers in a range have a property dependent on the sum of the digits so 0601 and 16 for example would both have the same property. – Zev Oct 30 '17 at 12:16
  • 00601 and 601 are considered to be the same solution. The property I'm looking at is that the sum is prime and the sum of the squares of the digits are prime (1 + 6 = 7 and 1 + 36 =37). So if I discover the 16 has that property, the order and number of zeros don't matter. – Zev Oct 30 '17 at 13:22

1 Answers1

1

This isn't a formula but a strategy. So day you want to calculate this between $a$ and $b$. Where a has $k_1$ digits and $b$ has $k_2$ digits. Such that $k_1 \le k_2$

The smallest number you can make with $k$ digits is $100..6$ where number of zeroes are $k-2$ and the largest you can make is $6100..$ where number of zeroes are still $k-2$. And total different numbers are $2k-2$ if we never add a leading $0$ as that would be a repetition of the lower $k$.

So now you still have to manually check for $k_1$ digits and $k_2$ digits but anything in between you can right away calculate. Also the numbers in order look something like this, say for $k=4$ $$(1006, 1060, 1600, 6001, 6010, 6100)$$

Sonal_sqrt
  • 4,711