Control C301A P57404


Statement
 

pdf   zip

A natural number n>0n > 0 is called powerful if, for each prime divisor pp of nn, p2p^2 is also divisor of nn. For example, 55125=335557755125 = 3\cdot3\cdot5\cdot5\cdot5\cdot7\cdot7 is a powerful number, because every prime factor appears, at least, twice.

Your task is to write a program that reads a sequence of numbers mm and, for each one, prints all the powerful numbers between 1 and mm.

Input

The input is a sequence of natural numbers m>0m > 0.

Output

For each mm of the input, print a line with all the powerful numbers between 1 and mm, separated by commas and in increasing order.

Observation

Your program must implement and use the function

    bool is_powerful(int n);

that, given an integer strictly positive |n|, indicates if is powerful or is not

Public test cases
  • Input

    27
    28
    26
    1
    3
    4
    270
    

    Output

    1,4,8,9,16,25,27
    1,4,8,9,16,25,27
    1,4,8,9,16,25
    1
    1
    1,4
    1,4,8,9,16,25,27,32,36,49,64,72,81,100,108,121,125,128,144,169,196,200,216,225,243,256
    
  • Information
    Author
    Professorat de P1
    Language
    English
    Translator
    Carlos Molina
    Original language
    Catalan
    Other languages
    Catalan
    Official solutions
    C++
    User solutions
    C++