Guys, some help...
Whats the best math formula to resolve this ?
(i came out with that one, pic related, but i'm not sure)
"All natural numbers bellow 1000000 i can form using only the 0~9 digits, without repeating them and not accepting only zero nor zeros to the left.
>>56405710
>not accepting only zero nor zeros to the left
So 0, 00, 000, etc. don't count? 100, 386, count, but 0100, 00100, 00386 do not count?
>>56405935
yes, its the all the set W is all about.
https://www.cymath.com/
wut ?
>>56405953
Okay, well, you need to have at least one non-zero digit. You can pick this in 9 ways (one for each digit 1 to 9). Since you want a number less than 1000000, you can have at most 5 digits.
Thus, you can pick the first digit in 9 ways: one for each digit from 1 to 9. The rest of the digits are chosen from the remaining 9 (0 to 9, excluding the one your first picked). Order matters, so you use permutations:
You can pick k digits in 9*P (9,k-1) ways, so just sum that from k = 0 to 5
>>56405710
Why did you write 9-(x-1) and not 10-x tho
>>56405710
Your solution's right. K is the amount of numbers you can make that don't have repeating digits and W is the amount of those numbers that start with a zero, which is a tenth. So K-W is the amount of non-repeating numbers that don't have 0's on the left.
hi
>>56406412
to keep the same ratio 1~6, 1 meaning one digit and 6 the maximum allowed digit (last number would be 999999, 6 digits).
But i guess there's no math formula other than summation of combinations. Well, thanks anyway.
>>56405710
1) This belongs to >>>/sci/
2) I smell homework
3) It's a really simple task, statistics 101:
First we get all numbers with 6 digits:
The first digit has 9 possibilities (1-9), second number also 9 (0-9 minus the previous one) and so on - so it's "9 * 9 * 8 * 7 * 6 * 5" possibilities.
And so on.
No fuck off.
>>56407354
By the way, I get the same result as you:
(9 * 9 * 8 * 7 * 6 * 5)
+ (9 * 9 * 8 * 7 * 6)
+ (9 * 9 * 8 * 7)
+ (9 * 9 * 8)
+ (9 * 9)
+ 9
=
136,080
+ 27,216
+ 4,536
+ 648
+ 81
+ 9
=
168570
>>56407354
yes man, i did it, in case you didn't notice its answered, i'm just looking to improve my answer.
i can do some simplification as:import math
f = math.factorial
r = 0
for i in range(1,7):
r+=(f(10)-f(9))/f(10-1)
print(r)
>>56407539
i mean:for i in range(1,7):
r+=(f(10)-f(9))/f(10-i)
>>56405710
why isn't the answer 999999 for all numbers below 100000 that aren't 0?
>>56407602
can't repeat digits 0~9
its just 987654 the higher one
>>56407539
You can also write it like this:
9 * 9 * 8 * 7 * 6 * 5 ( 1 + 1/5 + 1/(6*5) + 1/(7*6*5) + 1/(8*7*6*5) + 1/(9*8*7*6*5) )
Then you can transform it into this:
9 * (9!/4!) * ( 1/(4!/4!) + 1/(5!/4!) + 1/(6!/4!) + 1/(7!/4!) + 1/(8!/4!) + 1/(9!/4!) )
Which is the same as:
9 * (9!/4!) * 4! * (1/4! + 1/5! + 1/6! + 1/7! + 1/8! + 1/9!)
And finally:
9 * 9! * (1/4! + 1/5! + 1/6! + 1/7! + 1/8! + 1/9!)
I doubt it gets any shorter than this.