4 added 1901 characters in body
source | link

Haskell, 42 bytes

0?0=1
a?b=sum[a?i+i?a|i<-[0..b-1]]
f n=n?n

Try it online!

A slowfairly direct recursionimplementation that recurses over 2 variables.

Here's how we can obtain this solution. Start with code implementing a direct recursive formula:

54 bytes

0%0=1
a%b=sum$map(a%)[0..b-1]++map(b%)[0..a-1]
f n=n%n

Try it online!

Using flawr's rook move interpretation , nota%b is the number of paths that get the rook from (a,b) to (0,0), using only moves the decrease a coordinate. The first move either decreases a or decreases b, keeping the other the same, hence the recursive formula.


 

49 bytes

a?b=sum$map(a%)[0..b-1]
0%0=1
a%b=a?b+b?a
f n=n%n

Try it online!

We can avoid the repetition in map(a%)[0..b-1]++map(b%)[0..a-1] by noting that the two halves are the same with a and b swapped. The auxiliary call a?b counts the paths where the first move decreases a, and so b?a counts those where the first move decreases b. These are in general different, and they add to a%b.

The summation in a?b can also be written as a list comprehension a?b=sum[a%i|i<-[0..b-1]].

42 bytes

0?0=1
a?b=sum[a?i+i?a|i<-[0..b-1]]
f n=n?n

Try it online!

Finally, we get rid of % and just write the recursion in terms of ? by replacing a%i with a?i+i?a in the recursive call.

The new base case causes this ? to give outputs double that of the ? in the 49-byte version, since with 0?0=1, we would have 0%0=0?0+0?0=2. This lets use define f n=n?n without the halving that we'd other need to do.

Haskell, 42 bytes

0?0=1
a?b=sum[a?i+i?a|i<-[0..b-1]]
f n=n?n

Try it online!

A slow direct recursion, not using a formula.


 

49 bytes

a?b=sum$map(a%)[0..b-1]
0%0=1
a%b=a?b+b?a
f n=n%n

Try it online!

Haskell, 42 bytes

0?0=1
a?b=sum[a?i+i?a|i<-[0..b-1]]
f n=n?n

Try it online!

A fairly direct implementation that recurses over 2 variables.

Here's how we can obtain this solution. Start with code implementing a direct recursive formula:

54 bytes

0%0=1
a%b=sum$map(a%)[0..b-1]++map(b%)[0..a-1]
f n=n%n

Try it online!

Using flawr's rook move interpretation ,a%b is the number of paths that get the rook from (a,b) to (0,0), using only moves the decrease a coordinate. The first move either decreases a or decreases b, keeping the other the same, hence the recursive formula.

49 bytes

a?b=sum$map(a%)[0..b-1]
0%0=1
a%b=a?b+b?a
f n=n%n

Try it online!

We can avoid the repetition in map(a%)[0..b-1]++map(b%)[0..a-1] by noting that the two halves are the same with a and b swapped. The auxiliary call a?b counts the paths where the first move decreases a, and so b?a counts those where the first move decreases b. These are in general different, and they add to a%b.

The summation in a?b can also be written as a list comprehension a?b=sum[a%i|i<-[0..b-1]].

42 bytes

0?0=1
a?b=sum[a?i+i?a|i<-[0..b-1]]
f n=n?n

Try it online!

Finally, we get rid of % and just write the recursion in terms of ? by replacing a%i with a?i+i?a in the recursive call.

The new base case causes this ? to give outputs double that of the ? in the 49-byte version, since with 0?0=1, we would have 0%0=0?0+0?0=2. This lets use define f n=n?n without the halving that we'd other need to do.

3 deleted 19 characters in body
source | link

Haskell, 4942 bytes

0?0=1
a?b=sum[a?i+i?a|i<-[0..b-1]]
f n=n?n

Try it online!

A slow direct recursion, not using a formula.


49 bytes

a?b=sum$map(a%)[0..b-1]
0%0=1
a%b=a?b+b?a
f n=n%n

Try it online!

A slow direct recursion, not using a formula.

Haskell, 49 bytes

a?b=sum$map(a%)[0..b-1]
0%0=1
a%b=a?b+b?a
f n=n%n

Try it online!

A slow direct recursion, not using a formula.

Haskell, 42 bytes

0?0=1
a?b=sum[a?i+i?a|i<-[0..b-1]]
f n=n?n

Try it online!

A slow direct recursion, not using a formula.


49 bytes

a?b=sum$map(a%)[0..b-1]
0%0=1
a%b=a?b+b?a
f n=n%n

Try it online!

2 deleted 47 characters in body
source | link

Haskell, 5449 bytes

0%0=1
a%b=sum$mapa?b=sum$map(a%)[0..b-1]++map(%b)[0..a-1]
0%0=1
a%b=a?b+b?a
f n=n%n

Try it online!Try it online!

No formula, just aA slow direct calculationrecursion, not using a formula.

Haskell, 54 bytes

0%0=1
a%b=sum$map(a%)[0..b-1]++map(%b)[0..a-1]
f n=n%n

Try it online!

No formula, just a slow direct calculation.

Haskell, 49 bytes

a?b=sum$map(a%)[0..b-1]
0%0=1
a%b=a?b+b?a
f n=n%n

Try it online!

A slow direct recursion, not using a formula.

1
source | link