OFFSET
0,5
REFERENCES
G. Balzarotti and P. P. Lava, Le sequenze di numeri interi, Hoepli, 2008, p. 110.
FORMULA
See program.
EXAMPLE
if n = 2, B(n) = B(2) = 1 because B(0) = 1, B(1) = 1 * B(0) = 1 as the distances of n from closest prime are 2, 1, 0, 0, 1 ...
MAPLE
A[0]:=d[0]; A[1]:=d[1]*A[0]+1; B[0]:=1; B[1]:=d[1]*B[0]; for n from 2 by 1 to N do A[n]:=d[n]*A[n-1]+A[n-2]; B[n]:=d[n]*B[n-1]+B[n-2]; od;
CROSSREFS
KEYWORD
frac,nonn
AUTHOR
Giorgio Balzarotti and Paolo P. Lava, Sep 28 2005
STATUS
approved