0123456789 abcde fghik, 1 try a in 123456789, can't start with 0 per fresh_42
0..3456789 1bcde 2ghik, 2 bcde <= 4999, try b in 03
0..3456789 10cde 20hik, 3 rejected repeated 0
0..3456789 13cde 21hik, 3 rejected repeated 1
0.2.456789 1bcde 3ghik, 2 bcde >= 5000, try b in 56789
..2.4.6789 15cde 30hik, 3 cde <= 499 try c in 24
......6789 152de 304ik, 4 de <= 49 rejected no possible values for d
....4.6789 152de 305ik, 4 de >= 50 rejected repeated 5
..2...67.9 154de 308ik, 4 de <= 49 try d in 2
......67.9 1542e 3084k, 5 e <= 4 rejected repeated 4
......67.9 1542e 3085k, 5 e >= 5 rejected repeated 5
..2...678. 154de 309ik, 4 de >= 50 try d in 678
.......78. 1546e 3092k, 5 e <= 4 rejected no possible values for e
..2....78. 1546e 3093k, 5 e >= 5 rejected repeated 3
..2...6.8. 1547e 3094k, 5 e <= 4 rejected repeated 4
..2...6.8. 1547e 3095k, 5 e >= 5 rejected repeated 5
..2....7.. 1548e 3096k, 5 e <= 4 will try e in 2
.......7.. 15482 30964, 5 e <= 4 rejected repeated 4
.......... 15486 30972, stop
Too big. I think your algorithms doesn't consider the carries and rejects possible solutions.New attempt, same algorithm
Solution is n=15486, 2n=30972
Code:0123456789 abcde fghik, 1 try a in 123456789, can't start with 0 per fresh_42 0..3456789 1bcde 2ghik, 2 bcde <= 4999, try b in 03 0..3456789 10cde 20hik, 3 rejected repeated 0 0..3456789 13cde 21hik, 3 rejected repeated 1 0.2.456789 1bcde 3ghik, 2 bcde >= 5000, try b in 56789 ..2.4.6789 15cde 30hik, 3 cde <= 499 try c in 24 ......6789 152de 304ik, 4 de <= 49 rejected no possible values for d ....4.6789 152de 305ik, 4 de >= 50 rejected repeated 5 ..2...67.9 154de 308ik, 4 de <= 49 try d in 2 ......67.9 1542e 3084k, 5 e <= 4 rejected repeated 4 ......67.9 1542e 3085k, 5 e >= 5 rejected repeated 5 ..2...678. 154de 309ik, 4 de >= 50 try d in 678 .......78. 1546e 3092k, 5 e <= 4 rejected no possible values for e ..2....78. 1546e 3093k, 5 e >= 5 rejected repeated 3 ..2...6.8. 1547e 3094k, 5 e <= 4 rejected repeated 4 ..2...6.8. 1547e 3095k, 5 e >= 5 rejected repeated 5 ..2....7.. 1548e 3096k, 5 e <= 4 will try e in 2 .......7.. 15482 30964, 5 e <= 4 rejected repeated 4 .......... 15486 30972, stop
0123456789 abcde fghik, 1 try a in 123456789, can't start with 0 per fresh_42
0..3456789 1bcde 2ghik, 2 bcde <= 4999, try b in 03
...3456789 10cde 20hik, 3 cde <= 499 rejected repeated 0
...3456789 10cde 21hik, 3 cde >= 500 rejected repeated 1
0...45.789 13cde 26hik, 3 cde <= 499 try c in 04 (this is the line that had a bug... 2*13 = 26, not 21, haha)
....45.789 130de 260ik, 3 de <= 499 rejected repeated 0
....45.789 130de 261ik, 3 de >= 500 rejected repeated 1
0....5.7.9 134de 268ik, 3 de <= 499 try d in 0
.....5.7.9 1340e 2680k, 4 e <= 4 rejected repeated 0
.....5.7.9 1340e 2681k, 4 e >= 5 rejected repeated 1
0....5.78. 134de 269ik, 3 de >= 500 try d in 578
.......78. 1345e 2690k, 4 e <= 4 rejected no values for e
0......78. 1345e 2691k, 4 e >= 5 rejected repeated 1
0....5..8. 1347e 2694k, 4 e <= 4 rejected repeated 4
0.......8. 1347e 2695k, 4 e >= 5 try e in 8
0......... 13478 26956, rejected repeated 6
0....5.7.. 1348e 2696k, 4 e <= 4 rejected repeated 6
0....5.... 1348e 2697k, 4 e >= 5 try e in 5
.......... 13485 26970, stop
This is correct, keep on learning!On 3rd try, solution is n=13485 2n=26970; if this is still wrong I'm giving up high school and going back to primary school
Code:0123456789 abcde fghik, 1 try a in 123456789, can't start with 0 per fresh_42 0..3456789 1bcde 2ghik, 2 bcde <= 4999, try b in 03 ...3456789 10cde 20hik, 3 cde <= 499 rejected repeated 0 ...3456789 10cde 21hik, 3 cde >= 500 rejected repeated 1 0...45.789 13cde 26hik, 3 cde <= 499 try c in 04 (this is the line that had a bug... 2*13 = 26, not 21, haha) ....45.789 130de 260ik, 3 de <= 499 rejected repeated 0 ....45.789 130de 261ik, 3 de >= 500 rejected repeated 1 0....5.7.9 134de 268ik, 3 de <= 499 try d in 0 .....5.7.9 1340e 2680k, 4 e <= 4 rejected repeated 0 .....5.7.9 1340e 2681k, 4 e >= 5 rejected repeated 1 0....5.78. 134de 269ik, 3 de >= 500 try d in 578 .......78. 1345e 2690k, 4 e <= 4 rejected no values for e 0......78. 1345e 2691k, 4 e >= 5 rejected repeated 1 0....5..8. 1347e 2694k, 4 e <= 4 rejected repeated 4 0.......8. 1347e 2695k, 4 e >= 5 try e in 8 0......... 13478 26956, rejected repeated 6 0....5.7.. 1348e 2696k, 4 e <= 4 rejected repeated 6 0....5.... 1348e 2697k, 4 e >= 5 try e in 5 .......... 13485 26970, stop
for i in range(10000,100000):
if ''.join(sorted(str(i)+str(2*i)))=="0123456789":
print i
break
3.) Show that $$\int_{0}^{1} dx \int_{x}^{\sqrt{x}} f(x,y)\,dy = \int_{0}^{1} dy \int_{y^2}^{y} f(x,y)\,dx\,.$$
ThanksYou could do it with the upload button at bottom right of the edit field, but I would appreciate if you wouldn't. Here's a guideline to write formulas on PF:
https://www.physicsforums.com/help/latexhelp/
It does not only look like it, it is the reason:I wonder what deep property lies buried in this number, so that it does that, other than it looks suspiciously like 1/7 = 0.142857...
I guess a simple count is easier and faster.5b could be done in Python?
First calculate 1000! then use python to count the zeroes?
This is not correct. You cannot count those in between!5b:
import math
A = str(math.factorial(1000))
A.count('0')
472
It can be done in one line without coding, two, if an explanation line is added!I got this but i made mistake somewhere
import math
A = (str(math.factorial(1000)))
B = (str(int(math.factorial(1000)))[::-1])
C = len(A) - len(B)
print(C)
I'm new to this, only know what we learnt in lectureIt can be done in one line without coding, two, if an explanation line is added!
You know that every integer can be written as a product of primes? That's all you need, and some 3rd grader divisions.I'm new to this, only know what we learnt in lecture
Your approach should work in principle. Expand your calculation of B over several steps and make sure each one is doing what you think it is - I can think of a couple of likely failure points.I'm new to this, only know what we learnt in lecture
Why did you count the twos? Were you afraid there might not be enough of them?I tried the 1000! problem with logic, by counting the x10 and x100 numbers, then counting the x2 . x5 combinations that produce 1, 2, 3 and 4 zeroes... but I got the wrong total of zeroes compared to the real number from Wolfram-Alpha's ...
That puts me back in kindergarten, oh no.. :(
I have serious trouble decoding that! I assume that "xN." doesn't mean the hexadecimal number N?Because 2.5 = 10, so each group of 1.2.3.4.5.6.7.8.9 = 2.5.(1.3.4.6.7.8.9) = 10.(36,288)
So numbers that end in 1,3,4,6,7,8,9 don't add any zeroes to the result ( ex x3.x6 = (10x+3).(10x+6) = 100x^2 + 10.(3+6).x + 6.3... no zeroes in any x6.x3 for all x in {0..99} ).
As any number ending in 2 will be followed by a number ending in 5 in the sequence {1..1000}, then for x in 0..99 we have x2.x5 = 100x^2 + 10.(2+5)x + 10 = 100x^2+10(7x+1), therefore x2.x5 add zeroes. So we get 1x3 zeroes from 1000, 9x2=18 zeroes from 100, 200, .. , 900, 90x1 zeroes from 10, 20, ..., 90, 110, 120, ..., 190, 210, ... , 290, .. , 990, = 111 zeroes, plus the zeroes from the multiplications of x2.x5.
The zeroes for x2.x5 will be 1 for each x in 0..99... which is 100 numbers (ex 22.25 = 550); then 1 more for each (10.x^2 mod 10 + 7x+1) that is multiple of 10; then 1 more for each (x^2 mod 10 + 7x+1 ) that is multiple of 100. Inspection shows that only x=7, 17, 27, ..., 97 produces that expression as multiple of 10 (ex 372.375 = 139,500), and only 87 produces an expression that is multiple of 100 (872.875 = 736,000). So the x2.x5 terms produce 100 + 10 + 1 = 111 zeroes.
This calculation yields 222 zeroes, but Wolfram-Alpha shows 249 zeroes, so my result is wrong... I'm missing something and I have no clue what... :-(
Back to kindergarten, fbs7!