IBM Ponder This 上个月的题目很有意思:利用各种数学函数和数学符号,用两个数字 2 得到一个 5 。不过,有一些限制条件:
1. 只能够使用两次数字 2 。因此,像 2 + 2 + 2/2 这样的算式是不行的。
2. 不允许使用变量,因此 (2x + 2x + x)/x 也是不合法的。
3. 不允许使用其它常量,因此 2 + 2 + ln(e) 是不合法的,因为用到了常量 e 。诸如 (2+i)(2-i) 的妙解也因此被禁止了。
4. 不允许使用取整类的函数,否则问题就太简单了,例如⌈√(2*2)!⌉。
一个非常巧妙的解是 cos(atan(2))-2 。注意直角边为 1:2 的直角三角形,斜边长应该是 √5 ,那么 cos(atan(2)) 就应该等于 1/√5 ,它的 -2 次方就是我们要求的结果了。
另一个比较万能的解则是 -log2(ln(√√√√√√exp(2))) 。显然 √exp(2) 就等于 e ,再连续开 5 次平方后就等于e1/32 ,取对数后就是 1/32 ,相当于 2-5 。因此, -log2(1/32) 就恰好等于 5 了。显然,我们还能用这种方法把两个 2 变成任意一个整数。
介个太变态了太变态了!!!连你“禁止”了的那些方法我都想不到的说!!!怒~!
我忍不住再写一条:我竟然坐到沙发了……
ln 不是隐含一个底数10么 这个不算常数阿?
第二个解用到了常量e
@philipslcd
第二个解算是打擦边球吧 可以理解成使用函数表达式
如果可以用计算机就简单了,用两个无符号整型数表示2(00000010),使用位运算,其中一个2左移一位(00000100),另一个2右移一位(00000001),两数相加就得到5(00000101)了。
exp()这个函数用到常数e了吧?
限制很多呢…IBM出题的时候就规定了标准答案吧……
开个玩笑:
定义函数 f: {(2,2)}->{5} 满足 f(2,2)=5.
OK, f(2,2), 解毕.
如果第二个解合理的话,那么我写2 + 2 + ln(√exp(2) )应该也合理吧?
第一种解法可以..
第二种解法使用了隐藏的常数e…
这个算是霍格特(V.Hoggatt)公式吧
-log2(√√√√√2)) 不就得了?
不对,这样只能算出2的证书次幂。。
第二种怎么看也是用了e的,我觉得相当于只是用运算符取巧得到运算中隐含的2而已,用不用exp函数无关紧要,但是要用log2又会超2的个数~看起来不怎么可行诶
跑一下题
2+2是等于5的其实……
赞楼上。在大洋国,派对说2+2是几就是几。
我也跑一下题,刚刚发现12和14之间是13a也……
呃,忽略楼上,我说的12a
第二个确实有点勉强
WOW jus wha I was looking for. Came here by searhing foor 201
同12a,第二个不用自然指数对数吧。
cos(atan(2))^-2 这个,打死我也想不到。
cos等函数必须用到常量e,所以三角函数也应该是禁止的
同理exp也是e的函数……文字游戏>3<
我的方法:
→ → →
2+2=5
这是向量和哦~
2的4次方再开平方(为了躲避平方的2^-^)+2的零次方
26楼的方法不是用到4了么……嘿嘿
25楼错了。
3个2倒是可以算出任意整数
我想到一个很冷的F(2+2)。。F是斐波那契数。。
function f(a,b){
return 5;
}
f(2,2)
哈哈哈哈哈哈哈哈哈哈哈哈哈哈哈哈哈哈哈哈哈哈哈哈哈哈哈哈哈哈哈哈哈哈哈哈哈哈哈哈哈哈哈哈哈哈哈哈哈哈哈哈哈哈哈哈哈哈哈哈哈哈哈哈哈哈哈哈哈哈哈哈哈哈哈哈哈哈哈哈哈哈哈哈哈哈哈哈哈哈哈哈哈哈哈哈哈哈哈哈哈哈哈哈哈哈哈哈哈哈哈哈哈哈哈哈哈哈哈哈哈哈哈哈哈哈哈哈哈哈哈哈哈哈哈哈哈哈哈哈哈哈哈哈哈哈哈哈哈哈哈哈哈哈
我还以为什么方法添
没想出来,答案好复杂。。
斐波那契数 F(2+2) = F(4) = 3 吧
(2^2)++ = 5
5 = (2^2)++
5 = (2*2)++
5 = (2+2)++
5 = 2++ + 2
cos等函数好似不用到常量e吧。。。
总之这题。。要求比答案好看
2+2其实就是等于5的….见这里
http://en.wikipedia.org/wiki/2+2=5
党说:2+2=5
补充说明中, squaring will cost you one “2” and other constant powers are not allowed. 所以用根号得到任意整数的方法就不符合要求了~
2.5+2.5
只要党愿意,二加二等于五
2 + Prime[2] 就可以…
这个很牛,第二个有些问题
36L
++ 不能用在值上。。。
你编过C么
其实开平方的根号隐藏了常量2……
额….自己定义一个函数吧(限制条件可没说不让自己定义函数)
定义:P→(m,n)为自素数m起沿数轴正向的第n个素数的值,m取一切素数,n取一切正整数。
显然:P→(2,2)=5
-40
指数定义
三角形的那个应该是IBM希望的正解,我一开始想的时候,移位和进制转换都想过了。三角函数这个确实是最巧妙的。
2>>1+2<<1=5
prime[2]+2=3+2=5
exp不算“用到了e”
因为exp(x)=1+x+x^2/2+x^3/6+x^4/24+…
喔 有些难度咯!
我记得有一个方法只用三角函数和平方根可以使任意一个数+1,具体什么式子忘了。算24点的时候碰到的坑爹方法。
Succ(2)+2
f(x):=secatanx
f^(w^2-f^2)f=w
3个2倒是可以算出任意整数
好文章!666,学习了
It’s going to be ending of mine day, but before finish I am reading this
fantastic post to improve my knowledge.
Wow, superb blog layout! How long have you been blogging for?
you made blogging look easy. The overall look of your web site is wonderful,
let alone the content!
After I originally left a comment I appear to have clicked the -Notify me
when new comments are added- checkbox and now whenever a
comment is added I recieve four emails with the exact same comment.
Is there a way you can remove me from that service? Thanks a lot!
Good post. I will be dealing with many of these issues as well..
Hello, just wanted to say, I loved this post. It was funny.
Keep on posting!
hello there and thank you for your info – I have definitely picked up something new from right
here. I did however expertise a few technical issues using this website, since I experienced
to reload the site lots of times previous to I could get it to load correctly.
I had been wondering if your hosting is OK? Not that I am complaining,
but slow loading instances times will sometimes affect your placement in google and
can damage your high-quality score if ads and marketing with Adwords.
Well I am adding this RSS to my email and can look out for a
lot more of your respective fascinating content.
Ensure that you update this again soon.
Hi there to every , for the reason that I am genuinely keen of reading this website’s post to be updated regularly.
It includes fastidious information.
Hello, its pleasant article regarding media print, we all be familiar
with media is a fantastic source of data.
I always spent my half an hour to read this blog’s articles daily along with a mug of coffee.
Hi everyone, it’s my first goo to see at thyis website,
and piece of writing iss genuinely fruitful iin support oof me,
keep uup posting these types of content.
I have been surfing on-line greater than three hours as of
late, yet I by no means found any attention-grabbing article like yours.
It’s lovely value sufficient for me. In my view, if all webmasters
and bloggers made just right content material as you probably did, the net shall be a lot more useful than ever before.
Thanks in support of sharing such a pleasant thinking, piece of writing is fastidious, thats why i have read it completely
Awesome things here. I’m very happy to see your post.
Thank you a lot and I’m having a look ahead to contact you.
Will you kindly drop me a mail?
I am regular reader, how are you everybody? This article posted at this site is truly
good.
Greetings from Colorado! I’m bored too tears at work so I decided tto ccheck out your
blo onn my iphone djring linch break. I lobe the
info yoou provide here and can’t waitt to tak a look when I get home.
I’m suurprised at how quick your blog liaded onn my cell phlne ..
I’m noot evenn usijng WIFI, just 3G .. Anyways, amazzing site!
WOW juswt what I was looking for. Camee heree byy seaching
forr porn
Howdfy vdry nice site!! Guy .. Beautiful .. Superb .. I’ll booikmark
your web sijte and take the feeds additionally?
I amm happy to sedek out soo many useful inforemation right here within tthe put up, we’d ljke deveoop morre techniques
inn thnis regard, thanks forr sharing. . . . . .