%I #12 Oct 23 2016 16:04:33
%S 0,1,1,1,3,7,9,4,5,10,16,17,11,5,12,20,23,17,9,20,18,13,14,33,43,31,
%T 28,27,2,29,4,57,34,73,33,2,34,6,71,114,90,4,71,116,117,28,9,91,248,
%U 161,4,91,362,232,6,161,4,323,6,393,6,322,4,716,6,715,6,644,4,1431,6,1359,6
%N Pseudo Q-numbers.
%H Reinhard Zumkeller, <a href="/A038135/b038135.txt">Table of n, a(n) for n = 0..10000</a>
%F a(n)=a(abs(n-a(n-1)))+a(abs(n-a(n-2)))+a(abs(n-a(n-3)), a(j)=0 for j>n.
%t a[0] = 0; a[1] = a[2] = a[3] = 1; a[n_] := a[n] = Module[{b}, b[j_ /; j > n] = 0; b[j_] := a[j]; b[Abs[n - b[n-1]]] + b[Abs[n - b[n-2]]] + b[Abs[n - b[n-3]]]]; Table[a[n], {n, 0, 100}] (* _Jean-François Alcover_, Oct 23 2016 *)
%o (Haskell)
%o import Data.List (genericIndex)
%o a038135 n = genericIndex a038135_list n
%o a038135_list = 0 : 1 : 1 : 1 : f 1 1 1 4 where
%o f u v w x = y : f v w y (x + 1) where
%o y = q (x - u) + q (x - v) + q (x - w)
%o q z = if abs z >= x then 0 else a038135 $ abs z
%o -- _Reinhard Zumkeller_, Sep 21 2014
%Y Cf. A005185.
%K nice,nonn
%O 0,5
%A _Felice Russo_
%E More terms from Larry Reeves (larryr(AT)acm.org), Apr 04 2000