#P13395. [GCJ 2010 #1B] Your Rank is Pure

[GCJ 2010 #1B] Your Rank is Pure

题目描述

Pontius: You know, I like this number 127, I don't know why.
Woland: Well, that is an object so pure. You know the prime numbers.
Pontius: Surely I do. Those are the objects possessed by our ancient masters hundreds of years ago. Oh, yes, why then? 127 is indeed a prime number as I was told.
Woland: Not... only... that. 127 is the 31st prime number; then, 31 is itself a prime, it is the 11th; and 11 is the 5th; 5 is the 3rd; 3, you know, is the second; and finally 2 is the 1st.
Pontius: Heh, that is indeed... purely prime.

The game can be played on any subset ss of positive integers. A number in ss is considered pure with respect to ss if, starting from it, you can continue taking its rank in ss, and get a number that is also in ss, until in finite steps you hit the number 1, which is not in ss.

When nn is given, in how many ways you can pick ss, a subset of {2,3,...,n}\{2, 3, ..., n\}, so that nn is pure, with respect to ss? The answer might be a big number, you need to output it modulo 100003.

输入格式

The first line of the input gives the number of test cases, TT. TT lines follow. Each contains a single integer nn.

输出格式

For each test case, output one line containing "Case #xx: yy", where xx is the case number (starting from 1) and yy is the answer as described above.

2
5
6
Case #1: 5
Case #2: 8

提示

Limits

  • T100.T \leqslant 100.

Small dataset (14 Pts, Test set 1 - Visible)

  • Time limit: 30 3 seconds.
  • 2n25.2 \leqslant n \leqslant 25.

Large dataset (30 Pts, Test set 2 - Hidden)

  • Time limit: 60 6 seconds.
  • 2n500.2 \leqslant n \leqslant 500.