#include <stdio.h>
#include <stdlib.h>

/* run this program using the console pauser or add your own getch, system("pause") or input loop */

main() {
	
	int n = 10;
	int b;
	int alg;
	int pot;
	int numero;
	int bresilien;
	
	
	for(n = 1; n < 500; n++){
	  bresilien = 0;
		for(b = 2; b < n - 1 && !bresilien; b++){
			for(alg = 1; alg < b && !bresilien; alg++){
				numero = 0;
					for(pot = 1; numero < n && !bresilien; pot*= b){
						  numero += alg * pot;
						  if(numero == n){
						    printf("%d ", n);
						    bresilien = 1;
						}
				 }
			}
		}
	}
}


