%I #15 Apr 05 2021 09:17:50
%S 1,1,2,6,19,58,184,604,2017,6806,23161,79392,273614,946981,3289364,
%T 11460830,40036253,140175224,491756763,1728190792,6082921479,
%U 21440851774,75669652513,267362335333,945656056754,3347973882425,11863501369311,42072251661888
%N Number of lattice paths from (0,0) to (n,n) that consist of steps (h,v) with h, v prime or one.
%H Alois P. Heinz, <a href="/A308240/b308240.txt">Table of n, a(n) for n = 0..600</a>
%H Wikipedia, <a href="https://en.wikipedia.org/wiki/Lattice_path#Counting_lattice_paths">Counting lattice paths</a>
%p b:= proc(x, y) option remember; `if`(y=0, 1, add(add(
%p `if`((h=1 or isprime(h)) and (v=1 or isprime(v)),
%p b(sort([x-h, y-v])[]), 0), v=1..y), h=1..x))
%p end:
%p a:= n-> b(n$2):
%p seq(a(n), n=0..30);
%t f[p_List] := p + {0, p[[1]]}; f[0] = 0;
%t b[{x_, y_}] := b[{x, y}] = If[y == 0, {1, 1}, f[Sum[Sum[
%t If[(h == 1 || PrimeQ[h]) && (v == 1 || PrimeQ[v]),
%t b[Sort@{x - h, y - v}], {0, 0}], {v, 1, y}], {h, 1, x}]]];
%t a[n_] := b[{n, n}][[1]];
%t a /@ Range[0, 30] (* _Jean-François Alcover_, Apr 05 2021, after _Alois P. Heinz_ *)
%Y Cf. A000040, A008578, A308241, A308273.
%K nonn
%O 0,3
%A _Alois P. Heinz_, May 16 2019