CUBEFR - Cube Free Numbers


A cube free number is a number who’s none of the divisor is a cube number (A cube number is a cube of a integer like 8 (2 * 2 * 2) , 27 (3 * 3 * 3) ). So cube free numbers are 1, 2, 3, 4, 5, 6, 7, 9, 10, 11, 12, 13, 14, 15, 17, 18 etc (we will consider 1 as cube free). 8, 16, 24, 27, 32 etc are not cube free number. So the position of 1 among the cube free numbers is 1, position of 2 is 2, 3 is 3 and position of 10 is 9. Given a positive number you have to say if its a cube free number and if yes then tell its position among cube free numbers.

Input

First line of the test case will be the number of test case T (1 <= T <= 100000) . Then T lines follows. On each line you will find a integer number n (1 <= n <= 1000000).

Output

For each input line, print a line containing “Case I: ”, where I is the test case number. Then if it is not a cube free number then print “Not Cube Free”. Otherwise print its position among the cube free numbers.

Example

Sample Input:
10
1
2
3
4
5
6
7
8
9
10

Sample Output:
Case 1: 1
Case 2: 2
Case 3: 3
Case 4: 4
Case 5: 5
Case 6: 6
Case 7: 7
Case 8: Not Cube Free
Case 9: 8
Case 10: 9

hide comments
hardikpedia: 2021-11-01 17:25:11

Nice questions
WA 4 times
Day-2 attemoption

sk128: 2021-08-03 17:53:38

generating all prime numbers less than or equal to 101 will be sufficient .

Last edit: 2021-08-03 19:33:56
sankalp_7: 2021-06-24 17:36:02

Modified Sieve :D

nothuman_1: 2021-02-19 15:38:19

Nice ,Ac in 1 go

onkar_telange: 2020-10-03 18:11:36

Note that we have to print test case number not input n after case

fukrey: 2020-08-14 06:04:25

i don't know why spoj is not accepting same logic in java but if i use cpp or c it will be accepted.

harry_shit: 2020-05-20 15:45:36

it'll be safer to take array size 1000100

apoorva222g: 2020-04-20 14:26:17

precomputation with modified sieve

fighter_4: 2020-04-15 06:33:04

Sieve and precomputation will work ,AC in one go :D

monkscoder: 2020-01-20 11:30:05

Take care of formatting... costed me 2 WA


Added by:Muhammad Ridowan
Date:2011-06-14
Time limit:0.100s-1s
Source limit:50000B
Memory limit:1536MB
Cluster: Cube (Intel G860)
Languages:All except: ASM64
Resource:Own. For alternate thanks Sayef Azad Sakin