6 ms·
[5, 4, 3, 2, 1].map(n => Math.pow(n, n)).reduce((a, b) => a * b) === 1000 * 60 * 60 * 24 true
by Scooty 9y ago
[5, 4, 3, 2, 1].map(n => Math.pow(n, n)).reduce((a, b) => a * b) === 1000 * 60 * 60 * 24
true
- gerdesj 9y agoBlimey, I just used a spreadsheet 8) I'm not sure what language you are using but it actually comes close to looking like a proper proof - all the inputs are on show and the construction is reasonably obvious. My spreadsheet is trivially correct as well but some of the working is not on obvious show unless you inspect the cells. Also, my spreadsheet is unavailable unless I share it. Nice one.
- warent 9y agoIt's JavaScript, ES2015
- gerdesj 9y agoThanks. Google ECMAScript to me is the odd thing I had to learn (I have a really odd accent when speaking it) to get Novell's DirXML working.
- Jach 9y agoBe careful accepting JS numerical proofs, since they're all doubles. e.g. > 12345678910111210 + 1 == 12345678910111211 true > 12345678910111210 + 1 == 12345678910111212 true
- Franciscouzo 9y agoMy favorite one is disproving Fermat's last theorem: > 19774**3 + 257049**3 == 257088**3 true
- thomastjeffery 9y ago> Be careful ... e.g. > two true statements What?
- progval 9y agoShorter version (which actually checks for 0⁰ × 1¹ × 2² × 3³ × 4⁴ × 5⁵): > [0, 1, 2, 3, 4, 5].map(Math.pow).reduce((a, b) => a * b) === 1000 * 60 * 60 * 24 true
- vortico 9y agoa=1;for(i=1;i<=5;i++)a*=Math.pow(i,i);a === 1000 * 60 * 60 * 24 a=1;i=1;while(i++<5)a*=Math.pow(i,i);a === 1000 * 60 * 60 * 24
- TekMol 9y agoEven shorter version that simply does the calculation from the title of this post: 5**5*4**4*3**3*2**2*1**1===24*60*60*1000 true
- vortico 9y agoNice ES7. But if we're not constrained by leaving 5 as a "general" number, then 864e5 === 24 * 60 * 60 * 1000
- atonalfreerider 9y agoA better title: The fifth hyperfactorial: 5⁵ × 4⁴ × 3³ × 2² × 1¹ milliseconds is exactly 24 hours. A sidereal day is not exactly 24 hours, it is closer to 23 hours 56 minutes and 4.1 seconds.
- hanbura 9y agoThe word day is ambiguous, but calling it 24 hours is not perfect either. A 24 hour period can include leap seconds, meaning it can be one second longer or shorter than 24 * 60 * 60 seconds. (At least that's how ISO8601 defines time periods: 11pm-12am is a one hour period even if leap seconds cause the last minute to have 59 or 61 seconds)
- goodcanadian 9y agoWhen people talk about a day, they are usually thinking more of a solar day than a sidereal day. A solar day varies, but on average it is about 24 hours. That is after all how hours were originally defined.
- bouvin 9y agoI've always found it odd that English, which otherwise is fairly rich vocabulary-wise, does not have a specific word for this. In Danish, we have 'dag' (day), 'nat' (night), and 'døgn' (a day and a night). A 'døgn' contains all the leap seconds that may be necessary.
- hughdbrown 9y agoI thought it was ruby at first. (1..5).map{|n| n n}.reduce(:) == 24 60 * 60 * 1000
- godd2 9y agoLooks like you need to indent that code (1..5).map{|n| n**n}.reduce(:*) == 24 * 60 * 60 * 1000 Or if we're golfing (1..5).reduce{|t,n|t*n**n}
- yaccz 9y ago(foldl (*) 1 $ map (\x -> x**x) [0..5]) == 3600*24*1000 True
- 18nleung 9y agoLooks nice in Haskell too. product (map (\n -> n ^ n) [1..5]) == 1000 * 60 * 60 * 24 => True
- oerpli 9y agoI recommend looking at . and $ to make code more readable (by preventing unnecessary brackets) product $ map (\x -> x^x) [1..5] (.) :: (b -> c) -> (a -> b) -> a -> c ($) :: (a -> b) -> a -> b => f (g (h x)) == f . g . h $ 5
- jonahx 9y agoBow before J: (*/ 1000 60 60 24) = */ ^~ 1 2 3 4 5 1
- bakul 9y agoK: (24*60*60*1000)=*/x^x:!6 1 No stinking whitespace :-)
- jonahx 9y agoThat's preference. Can you say the same for that hideous variable name? :P
- bakul 9y agoThe following works too! (24*60*60*1000)=*/(!6)^!6 so does (24*60*60*1000)=1{x*y^y}/!6 but now you have two hideous parameters!
- arpankapoor 9y agoq: (24*60*60*1000)=prd xexp[x;x]til 6 1b Slightly more readable :P
- deleted 9y ago[deleted]