fork download
  1. #include <stdio.h>
  2. #include <stdlib.h>
  3. #include <stdint.h>
  4.  
  5. int main(void) {
  6. // your code goes here
  7. int64_t base[] = {3, 5, 7};
  8. int64_t num[] = {3, 5, 7};
  9. int64_t checkNum = 1;
  10. int64_t result = 1;
  11.  
  12. int n = 0;
  13. int i;
  14.  
  15. while (n < 100) {
  16. for (i = 0; i < sizeof(base)/sizeof(int64_t); i++) {
  17. if (result >= num[i]) {
  18. checkNum *= base[i];
  19. num[i] *= base[i];
  20. }
  21. }
  22. if (checkNum % result == 0) {
  23. printf("%d ", (int)result);
  24. n++;
  25. }
  26. result++;
  27. }
  28. return 0;
  29. }
  30.  
Success #stdin #stdout 0s 2008KB
stdin
Standard input is empty
stdout
1 3 5 7 9 15 21 25 27 35 45 49 63 75 81 105 125 135 147 175 189 225 243 245 315 343 375 405 441 525 567 625 675 729 735 875 945 1029 1125 1215 1225 1323 1575 1701 1715 1875 2025 2187 2205 2401 2625 2835 3087 3125 3375 3645 3675 3969 4375 4725 5103 5145 5625 6075 6125 6561 6615 7203 7875 8505 8575 9261 9375 10125 10935 11025 11907 12005 13125 14175 15309 15435 15625 16807 16875 18225 18375 19683 19845 21609 21875 23625 25515 25725 27783 28125 30375 30625 32805 33075