login

Year-end appeal: Please make a donation to the OEIS Foundation to support ongoing development and maintenance of the OEIS. We are now in our 61st year, we have over 378,000 sequences, and we’ve reached 11,000 citations (which often say “discovered thanks to the OEIS”).

A308274
Total number of nodes summed over all lattice paths from (0,0) to (n,n) that do not go above the diagonal x=y and consist of steps (h,v) with h, v prime or one.
3
1, 2, 5, 15, 47, 147, 469, 1531, 5076, 17014, 57537, 196043, 671980, 2314592, 8005266, 27784114, 96720440, 337572161, 1180869043, 4139120434, 14534125630, 51116699820, 180036470572, 634925138580, 2241803318605, 7923931456994, 28035799832528, 99284104334614
OFFSET
0,2
LINKS
MAPLE
b:= proc(x, y) option remember; `if`(y=0, [1$2], (p-> p+[0, p[1]])(
add(add(`if`((h=1 or isprime(h)) and (v=1 or isprime(v)) and
(x-h<=y-v), b(x-h, y-v), 0), v=1..y), h=1..x)))
end:
a:= n-> b(n$2)[2]:
seq(a(n), n=0..30);
MATHEMATICA
f[p_List] := p + {0, p[[1]]}; f[0] = 0;
b[{x_, y_}] := b[{x, y}] = If[y == 0, {1, 1}, f[
Sum[Sum[If[(h == 1 || PrimeQ[h]) && (v == 1 || PrimeQ[v]) &&
x-h <= y-v, b[{x-h, y-v}], {0, 0}], {v, 1, y}], {h, 1, x}]]];
a[n_] := b[{n, n}][[2]];
a /@ Range[0, 30] (* Jean-François Alcover, Apr 05 2021, after Alois P. Heinz *)
CROSSREFS
KEYWORD
nonn
AUTHOR
Alois P. Heinz, May 17 2019
STATUS
approved