This page is still under construction.

Parts of this page are still being built. What you see may change.

Triangle Pizza

Time limit1sMemory limit128 MB

Summary
Count the number of distinct connected polyiamonds with N cells, where shapes that match under rotation or translation count as one and reflections are distinct.
Level

Hard8 of 10

Topics
Backtracking, Implementation, Geometry, Brute force
Solved
No attempts yet

Problem

A pizzeria has launched a "triangle pizza" whose every slice is shaped like an equilateral triangle.

A triangle pizza is built from equilateral triangular slices that are all the same size and are joined into a single connected piece. Two slices are considered directly connected when they share an edge.

Write a program that counts the number of distinct shapes a triangle pizza made of exactly NN slices can take.

Two shapes are considered the same if one can be rotated and translated so that it exactly overlaps the other. (Flipping the shape over is not allowed.)

Input

The first line contains the number of test cases TT.

Each test case consists of a single line containing NN, the number of slices in the triangle pizza. (1≤N≤161 \le N \le 16)

Output

For each test case, print one line in the format Case #x: y, where xx is the test case number (starting from 1) and yy is the number of distinct triangle-pizza shapes that can be formed from NN slices.

Examples4

  1. Example 1

    Input
    3
    2
    4
    10
    
    Expected output
    Case #1: 1
    Case #2: 4
    Case #3: 866
    
  2. Example 2

    Input
    1
    1
    
    Expected output
    Case #1: 1
    
  3. Example 3

    Input
    1
    3
    
    Expected output
    Case #1: 1
    
  4. Example 4

    Input
    1
    5
    
    Expected output
    Case #1: 6