4meta5 / reconocer

recognize relations from integer sequences
MIT License
0 stars 0 forks source link

special sequences have different ranges #9

Closed 4meta5 closed 3 years ago

4meta5 commented 3 years ago

catalan numbers start s.t. C_0 = 1, C_1 = 1, C_2 = 2,...

cat(N,R) :-
    cat(1,N,1,R).
cat(X,N,R,R) :- X>=N.
cat(X,N,N1,R) :-
    X<N,
    X1 is X+1,
    N2 is (((4*X1)-2)*N1)/(X1+1),
    cat(X1,N,N2,R).

Fibonacci starts with f_0 = 0, but I'd rather omit that part of the sequence for sequence recognition because it isn't usually used.

Lucas numbers starts with l_0=2,l_1=1,l_2=3,.... but actually the current sequence generation is incorrect for a few of these

Derangement numbers start like d_0=1,d_1=0,d_2=1,d_2=2,d_3=9,....

4meta5 commented 3 years ago

fixed, the new seq(Goal,Name,StartingVal) s.t. StartingVal is where defined domain starts