duckduckgo/zeroclickinfo-goodies — pull request #830 by MichaelBurge (2014-12-11 08:04:48+00:00)
Title: Add support for computing binomial coefficients

# Goodie Pull Request Template

Using this template will help us better understand your Instant Answer and assist you when necessary. Simply copy and paste the markdown below into the description of your GitHub pull request and complete as appropriate.

**What does your Instant Answer do?**
It computes the Binomial Coefficients, or elements of Pascal's Triangle.

**What problem does your Instant Answer solve (Why is it better than organic links)?**
The instant answer only triggers on queries that appear to want a specific calculated result, and in these cases the user gets a result sooner.

**What is the data source for your Instant Answer? (Provide a link if possible)**
I own a copy of Wolfram Mathematica 9.0, which has the built-in Binomial calculation. The test table was computed using the following code:
Table[ Binomial[x, y], {x, 1, 10}, {y, 1, 10} ]

and can be reproduced using Wolfram Alpha:
http://www.wolframalpha.com/input/?i=Table%5B+Binomial%5Bx%2C+y%5D%2C+{x%2C+0%2C+10}%2C+{y%2C+0%2C+10}+%5D

**Why did you choose this data source?**
I consider Mathematica to be a trustworthy software.

**Are there any other alternative (better) data sources?**
Wikipedia has a table for the first several rows here:
https://en.wikipedia.org/wiki/Binomial_coefficient

And Google can also do this:
https://www.google.com/#q=7+choose+2

**What are some example queries that trigger this Instant Answer?**
binomial(7, 1)
binomial(7,1)
7 choose 1

**Which communities will this Instant Answer be especially useful for? (gamers, book lovers, etc)**
It makes DDG slightly more useful as a calculator, which benefits everyone

**Is this Instant Answer connected to a DuckDuckHack [Instant Answer idea](https://duck.co/ideas)?**
I didn't find one when I searched.

**Which existing Instant Answers will this one supercede/overlap with?**
I didn't see any that calculated this exact function. The Calculator.pm could be generalized to have a more robust formula parser, which would make this module along with several others(Fibonacci.pm, BinaryLogic.pm) redundant.

**Are you having any problems? Do you need our help with anything?**

**Where did you hear about DuckDuckHack? (For first time contributors)**
I searched for this Instant Answer, and when it didn't come up remembered that DuckDuckHack existed. I first heard about it several months ago, although I don't remember what lead me to it.

**What does the Instant Answer look like? (Provide a screenshot for new or updated Instant Answers)**

## Checklist
Please place an 'X' where appropriate.

```
[X] Added metadata and attribution information (https://duck.co/duckduckhack/metadata)
[X] Wrote test file and added to t/ directory (https://duck.co/duckduckhack/goodie_tests)
[X] Verified that instant answer adheres to design guidelines (https://duck.co/duckduckhack/design_styleguide)
[X] Verified that instant answer adheres to code styleguide (https://duck.co/duckduckhack/code_styleguide)
[X] Tested cross-browser compatibility

Please let us know which browsers/devices you've tested on:
- Windows 8
[X] Google Chrome
[X] Firefox
[] Opera
[X] IE 10

- Windows 7
[] Google Chrome
[] Firefox
[] Opera
[] IE 8
[] IE 9
[] IE 10

- Windows XP
[] IE 7
[] IE 8

- Mac OSX
[] Google Chrome
[] Firefox
[] Opera
[] Safari

- iOS (iPhone)
[] Safari Mobile
[] Google Chrome
[] Opera

- iOS (iPad)
[] Safari Mobile
[] Google Chrome
[] Opera

- Android
[] Firefox
[] Native Browser
[] Google Chrome
[] Opera