This is a little spoiler, so if you want to solve it yourself, do not read it yet :). I will try to give hints in order of sequence so that you can read each hint in order, and if you need more tips, proceed to the next hint, etc.
# 1:
n, n/divisor n. , 100/2 = 50 0, 2 100. , 50 100.
# 2
Hint # 1, , = 2 * <= n . , 100, 10 (10 * 10 - <= 100), , №1, . :
100 / 2 = 50, so 2 and 50 are factors
100 / 5 = 20, so 5 and 20 are factors
100 / 10 = 10, so 10 is a factor
# 3
n, n, , n/. sieve , .
# 4
C:
bool factors[100000];
void getprimefactors(int n) {
if (n == 0 || n == 1) return;
int divisor = 0;
for(int i = 2; i*i <= n; ++i) {
if (n % i == 0) {
divisor = i;
break;
}
}
if (divisor == 0) {
factors[n] = true;
return;
}
factors[divisor] = true;
getprimefactors(n / divisor);
}
int main() {
memset(factors,false,sizeof factors);
int f = 1234;
getprimefactors(f);
int largest;
printf("prime factors for %d:\n",f);
for(int i = 2; i <= f/2; ++i) {
if (factors[i]) {
printf("%d\n",i);
largest = i;
}
}
printf("largest prime factor is %d\n",largest);
return 0;
}
:
---------- Capture Output ----------
> "c:\windows\system32\cmd.exe" /c c:\temp\temp.exe
prime factors for 1234:
2
617
largest prime factor is 617
> Terminated with exit code 0.