by komputodo ➕follow (1) 💰tip ignore
Comments 1 - 40 of 50 Next » Last » Search these comments
for a,b,c,d in itertools.product(range(0,9+1),repeat=4):
if a1000+b100+c10+d + b100+c10+d + c10+d + d == 6666:
print(a,b,c,d,"",a+b+c+d)
5 8 1 9 23
6 3 1 9 19
Hey, is there a way that I can paste code into Patrick.net without having to deal with the multiplication character? Also, I had to add "nbsp"s to get the indenting to work. I put the above post in "code" blocks, but that only gave me the monospaced font.
There are two possibilities:
for a,b,c,d in itertools.product(range(0,9+1),repeat=4):
if a1000+b100+c10+d + b100+c10+d + c10+d + d == 6666:
print(a,b,c,d,"",a+b+c+d)
5 8 1 9 23
6 3 1 9 19
There are two possibilities:
for a,b,c,d in itertools.product(range(0,9+1),repeat=4):
if a1000+b100+c10+d + b100+c10+d + c10+d + d == 6666:
print(a,b,c,d,"",a+b+c+d)
5 8 1 9 23
6 3 1 9 19
this puzzle was on facebook...about 1300 people gave the answer and i think they were all wrong. They do not tell you the correct answer so I decided to see what you guys say. Nobody gave the same answer that i did.
There are two possibilities:
for a,b,c,d in itertools.product(range(0,9+1),repeat=4):
if a1000+b100+c10+d + b100+c10+d + c10+d + d == 6666:
print(a,b,c,d,"",a+b+c+d)
5 8 1 9 23
6 3 1 9 19
6319
319
19
9
That works. Brute force?
Ah, the iterative approach. I guess you coder geniuses have used the computer's ability do hundreds of guesses to displace the need for a math guy to derive a formula.
Did I misunderstand the question? A+B+C+D is either 6319 or 5819 in my mind..not 19, not 23...convince me that I am wrong. Also I didn't understand what Patricks answer was all about...6319, 319, 19, 9. They didn't ask what is B+C+D or what is C+D or what is D. They just asked what is A+B+C+D
ABCD +
BCD +
CD +
D
----
6666
What A, B, C, and D are is unknown, but each digit would have to be between 0 and 9
for a,b,c,d in itertools.product(range(0,9+1),repeat=4):
if a1000+b100+c10+d + b100+c10+d + c10+d + d == 6666:
print(a,b,c,d,"",a+b+c+d)
The digit for A is written as a 6 but it represents 6000 in the equation is what I'm saying.
#!/usr/bin/perl -w
exit (main (@ARGV));
sub main
{
for my $a (0..9)
{
for my $b (0..9)
{
for my $c (0..9)
{
for my $d (0..9)
{
if ((($a*$b*$c*$d) + ($b*$c*$d) + ($c*$d) + $d) == 6666)
{
printf ("%d %d %d %d\n", $a, $b, $c, $d);
}
}
}
}
}
return 0;
}
Lol, great point!
I found a solution for A, B, C, and D but I never answered the actual question, which asks what is A + B + C + D!
So I say the answer to that is 19.
how can it be 19? By that reasoning, a+b+c+d+b+c+d+c+d+d would equal 6666 but it doesn't...It equals 51.
A * 1000 + B * 100 + C * 10 + D
+ B * 100 + C * 10 + D
+ C * 10 + D
+ D
---------------------------------
6 * 1000 + 6 * 100 + 6 * 10 + 6 = 6666
komputodo says
how can it be 19? By that reasoning, a+b+c+d+b+c+d+c+d+d would equal 6666 but it doesn't...It equals 51.
Would you prefer the question to be:
A 1000 + B 100 + C 10 + D
+ B 100 + C 10 + D
+ C 10 + D
+ D
-------------------------------
6 1000 + 6 100 + 6 * 10 + 6
Then: "what is A+B+C+D?"
That's the real question. I think. It is poorly worded, and it has two solutions, and if I used normal mathematical notation, that's not the question, and if I use normal mathematical notation, there is no solution, at least for integers and if I don't use integers, there's an infinite number of solutions.
I think the question is just fine how it is written. It just seems to me that people are trying to overcomplicate it and that they have forgotten elementary school math.
Oh - I think I see the problem - where do you come up with this equation:
a+b+c+d+b+c+d+c+d+d
?
I don't agree this is a well worded question, because it has 2 solutions.
You must have misunderstood the question. It's asking:
ABCD +
BCD +
CD +
D
----
6666
SunnyvaleCA - that Python?
It's one equation with three unknowns. By the most elementary principles of linear algebra, this is a singular matrix, which necessarily has no unique solution.
That's cheating! You're supposed to do it in your head!
digits = "0123456789ABCDEF"
for base in range(6,16+1):
for a,b,c,d in itertools.product(range(0,base),repeat=4):
if a*base**3+b*base**2+c*base+d + b*base**2+c*base+d + c*base+d + d == (((6*base+6)*base+6)*base+6):
print(base,, digits[a],digits[b],digits[c],digits[d],,a+b+c+d)
7 6 2 6 5 19
10 5 8 1 9 23
10 6 3 1 9 19
11 5 8 5 7 25
13 6 2 A 8 26
14 5 9 B 5 30
14 5 A 1 C 28
14 6 2 B 5 24
14 6 3 1 C 22
richwicks says
Oh - I think I see the problem - where do you come up with this equation:
a+b+c+d+b+c+d+c+d+d
?
to simplify, lets do
its not 2+4+4...its 24 + 4
Comments 1 - 40 of 50 Next » Last » Search these comments
patrick.net
An Antidote to Corporate Media
1,261,050 comments by 15,056 users - AmericanKulak, stfu online now