20
0
Pascal's Rhombus (which is actually a triangle) is obtained by adding in the pattern:
*
***
x
instead of
* *
x
This means that each cell is the sum of the three cells on the row directly above it and one cell on the row 2 above it. Just like Pascal's triangle the zeroth row has a single 1
on it that generates the triangle.
Here are the first couple of rows of Pascal's Rhombus
1
1 1 1
1 2 4 2 1
1 3 8 9 8 3 1
Task
Given a row number (starting from the top) and an column number (starting from the first non-zero item on that row) output the value at that particular cell. Both inputs may be either 1 or 0 indexed (you may mix and match if you desire).
This is code-golf so you should aim to make the file size of your source code as a small as possible.
4
As with Pascal's triangle, the parity of the rhombus makes nice and fractal patterns.
– Martin Ender – 2017-07-06T09:02:36.793you should aim to make the file size of your source code as a small as possible what if I put my code as a command-line argument? :P – Erik the Outgolfer – 2017-07-06T09:57:00.703
Went googling for shortcuts and apparently https://arxiv.org/abs/1504.04404 says calculating the result directly is unusable for code golf.
– JollyJoker – 2017-07-06T15:03:34.370