/* Number of moves for a leap frog puzzle. See leap_frog_puzzle.pi For N = 1..15 (go2/0) this program gives these counts (lengths): counts=[3,8,15,24,35,48,63,80,99,120,143,168,195,224,255] It's http://oeis.org/A005563 """ A005563 n*(n+2) (or, (n+1)^2-1) .... This is also the number of moves that it takes n frogs to swap places with n toads on a strip of 2n+1 squares (or positions, or lilypads) where a move is a single slide or jump, """ * Point sequence maxCount = 3 code = (A * (A + 2)) = [[[1],3],[[2],8],[[3],15],[[4],24],[[5],35],[[6],48],[[7],63],[[8],80],[[9],99]] = [[10] = 120] * Recursive sequence: Order 2: data = [[[3,8],15],[[8,15],24],[[15,24],35],[[24,35],48],[[35,48],63],[[48,63],80],[[63,80],99]] unknown = [80,99] ops = (map)[user = [pow],infix = [+,-,*]] constants = [1,2] maxCount = 5 code = ((B + (B + 2)) - A) = [[[3,8],15],[[8,15],24],[[15,24],35],[[24,35],48],[[35,48],63],[[48,63],80],[[63,80],99]] = [[80,99] = 120] code = ((2 * (B + 1)) - A) = [[[3,8],15],[[8,15],24],[[15,24],35],[[24,35],48],[[35,48],63],[[48,63],80],[[63,80],99]] = [[80,99] = 120] */ data(dots_and_boxes,Data,Vars,Unknown,Ops,Constants,MaxC) :- Seq = [3,8,15,24,35,48,63,80,99], % ,120,143,168,195,224,255], Ops = new_map([infix=["+","-","*"] % , user=["pow"] ]), Constants = 1..2, MaxC = 5, ( println("point_seq:"), make_point_seq(Seq,Data,Unknown,Vars) ; println("seq:"), member(N,1..2), println(n=N), make_seq(Seq,N,Data,Unknown,Vars) ).