No Kaustubh No Fun, Know Kaustubh Know Fun..
There are only two hard things in computer science: cache invalidation, naming things, and offbyone errors
No Kaustubh No Fun, Know Kaustubh Know Fun..
Kaustubh G Sharma wrote:yup 120 is kinda easy if you follow the hint:
fact(fact(0)+fact(0)+fact(0)+fact(0)+fact(0))=120
but i think 125 is not possible
Joanne
Joanne Neal wrote:Is cubing a number allowed ?
cube (fact(0) + fact(0) + fact(0) + fact(0) + fact(0))
Matthew Brown wrote:
Joanne Neal wrote:Is cubing a number allowed ?
cube (fact(0) + fact(0) + fact(0) + fact(0) + fact(0))
I would have thought not  it ought to be 5^3, so you need a 3 from somewhere.
Joanne
There are only two hard things in computer science: cache invalidation, naming things, and offbyone errors
Joanne
fred rosenberger wrote:if you look at the windows calculator (in scientific mode) there is a cube button, so I think Joanne's solution is spoton!
Matthew Brown wrote:
Joanne Neal wrote:Is cubing a number allowed ?
cube (fact(0) + fact(0) + fact(0) + fact(0) + fact(0))
I would have thought not  it ought to be 5^3, so you need a 3 from somewhere. But I suppose it shows lateral thinking.
In which case:
0 + 0 + 0 + 0 + 0 + one hundred and twenty five
No Kaustubh No Fun, Know Kaustubh Know Fun..
Ryan McGuire wrote:Start with... 0 = 0
Multiply both sides by 125: 125 * 0 = 125 * 0
//fine till here
Evaluate the left side: 0 = 122 * 0
// from where you've got this 122?
Divide both sides by 0: 0/0 = 125
//then how you get the above step?
Add 0: 0/0 + 0 = 125 + 0
Subtract 0: 0/0 + 0  0 = 125
Add 0 again: 0/0 + 0  0 + 0 = 125 + 0
Evaluate the right side: 0/0 + 0  0 + 0 = 125
(I'm sure there are more subtle ways to hide the division by zero.)
No Kaustubh No Fun, Know Kaustubh Know Fun..
Mike Simmons wrote:Kaustubh, obviously the 122 was a typo; he meant 125. Just pretend he wrote 125 there, and it makes perfect sense.
Well, as much as dividing by zero ever makes sense.
No Kaustubh No Fun, Know Kaustubh Know Fun..
Mike Simmons wrote:If the previous line was
0 = 125 * 0
(corrected from 122)
and we divide both sides by 0 (pretending for a moment that this isn't an inherently horrible idea), we get (naively)
0/0 = (125 * 0)/0
which simplifies to
0/0 = 125
No Kaustubh No Fun, Know Kaustubh Know Fun..
Mike Simmons wrote:
Well, if you use the calculator argument, most calculators have mc, m+, mr for accessing a single memory register. With that, you can easily create any integer, with a suitable number of presses to the m+ key. You don't even need the factorial hint  cos(0) has the same result. I think allowing arbitrary calculator key makes things too easy.
There are only two hard things in computer science: cache invalidation, naming things, and offbyone errors
Ryan McGuire wrote:But seriously we can't give up yet!
What can you do with one zero to get other numbers?
0! = 1
That adds 1 to our "single zero" set.
asin(1) = 90 degrees, pi/2 radians or 100
So we're up to 0, 1, 90, 100, and pi/2.
We can square root any of those numbers:
sqrt(90) = 9.someodd
sqrt(100) = 10
sqrt(pi/2) = 1.someodd
If we add int(x) (aka floor(x)) to bag of tricks, we can add 9 and 10 to the numbers we can get to starting with a single 0.
we can apply sqrt() and int() again to 9 and/or 10 to get a 3.
So a single 0 can give us, 0, 1, 3, 9, 10, 90, 100 (among others plus a bunch of irrational numbers).
As a reminder here's how we got each of those:
0 = 0
1 = cos(0)
90 = the angle, in degrees, that has a sin of 1 = asind(1) = asind(cos(0))
100 = the angle, in gradians, that has a sin of 1 = asing(1) = asing(cos(0))
9 = int(sqrt(90)) = int(sqrt(asind(cos(0))))
10 = sqrt(100) = sqrt(asing(cos(0)))
3 = sqrt(9) = sqrt(int(sqrt(asind(cos(0)))))
After a little fiddling around, I found a way to combine 5 of those numbers to come up with 125.
125 = 100 + 10 + 9 + 3 + 3
125 = asing(cos(0)) + sqrt(asing(cos(0))) + int(sqrt(asind(cos(0)))) + sqrt(int(sqrt(asind(cos(0))))) + sqrt(int(sqrt(asind(cos(0)))))
BUT...
It pains me to use both asing() and asind(). I'd like to restrict myself to either one or the other.
I know, how about...
125 = 90 + (9*(3 + 1))  1
125 = asind(cos(0)) + ( int(sqrt(asind(cos(0)))) * ( sqrt(int(sqrt(asind(cos(0))))) + cos(0) ))  0!
...where asind(x) = arcsin(x) in degrees.
No Kaustubh No Fun, Know Kaustubh Know Fun..
Greg Charles wrote:The math looks right to me, and it's pretty brilliant. However, it does bring into question what operations are permitted. Why should we allow square roots (i.e., x ^ 0.5), but not allow cubes (i.e. x ^ 3)?
Greg Charles wrote:The math looks right to me, and it's pretty brilliant. However, it does bring into question what operations are permitted. Why should we allow square roots (i.e., x ^ 0.5), but not allow cubes (i.e. x ^ 3)? If we do allow cubes, then Joanne's solution is much simpler.
Ryan McGuire wrote:But seriously we can't give up yet!
What can you do with one zero to get other numbers?
0! = 1
That adds 1 to our "single zero" set.
asin(1) = 90 degrees, pi/2 radians or 100
So we're up to 0, 1, 90, 100, and pi/2.
We can square root any of those numbers:
sqrt(90) = 9.someodd
sqrt(100) = 10
sqrt(pi/2) = 1.someodd
If we add int(x) (aka floor(x)) to bag of tricks, we can add 9 and 10 to the numbers we can get to starting with a single 0.
we can apply sqrt() and int() again to 9 and/or 10 to get a 3.
So a single 0 can give us, 0, 1, 3, 9, 10, 90, 100 (among others plus a bunch of irrational numbers).
As a reminder here's how we got each of those:
0 = 0
1 = cos(0)
90 = the angle, in degrees, that has a sin of 1 = asind(1) = asind(cos(0))
100 = the angle, in gradians, that has a sin of 1 = asing(1) = asing(cos(0))
9 = int(sqrt(90)) = int(sqrt(asind(cos(0))))
10 = sqrt(100) = sqrt(asing(cos(0)))
3 = sqrt(9) = sqrt(int(sqrt(asind(cos(0)))))
After a little fiddling around, I found a way to combine 5 of those numbers to come up with 125.
125 = 100 + 10 + 9 + 3 + 3
125 = asing(cos(0)) + sqrt(asing(cos(0))) + int(sqrt(asind(cos(0)))) + sqrt(int(sqrt(asind(cos(0))))) + sqrt(int(sqrt(asind(cos(0)))))
BUT...
It pains me to use both asing() and asind(). I'd like to restrict myself to either one or the other.
I know, how about...
125 = 90 + (9*(3 + 1))  1
125 = asind(cos(0)) + ( int(sqrt(asind(cos(0)))) * ( sqrt(int(sqrt(asind(cos(0))))) + cos(0) ))  0!
...where asind(x) = arcsin(x) in degrees.
No Kaustubh No Fun, Know Kaustubh Know Fun..
In an interview I have asked to get 125 while performing any kind of mathematical operation between five 0....
ie I have 0 0 0 0 0 and by doing any mathematical operation between them I need to get digit 125...
HINT : factorial of 0 =1
cube (fact(0) + fact(0) + fact(0) + fact(0) + fact(0))
anirudh jagithyala wrote:Hi All,
So the solution given by Joanne
cube (fact(0) + fact(0) + fact(0) + fact(0) + fact(0))
is absolutely right....
Check out the definitions for mathematical operation and mathematical functions........
anirudh jagithyala wrote:i looked at the requirements from my point of view......
This argument would continue endless until the requirement is exactly fixed as all of us are assuming our own assumptions.
It would be better for the person who posted originally kaustabh to give the fixed set of requirements and constraints.
No Kaustubh No Fun, Know Kaustubh Know Fun..
Mike Simmons wrote:Agreed. I only objected because you were using terms like "absolutely" and repeating "use of mathematical functions" in bold, without acknowledging the ambiguities we've been talking about.
No Kaustubh No Fun, Know Kaustubh Know Fun..
Tak Ming Laio wrote:(.008)^((0!))
2 0's make an 8
No Kaustubh No Fun, Know Kaustubh Know Fun..
I'm so happy! And I wish to make this tiny ad happy too:
Thread Boost feature
https://coderanch.com/t/674455/ThreadBoostfeature
