I was searching for an solution for getting the greatest prime factor of a number and found a script that works, but there is a ?
(Question Mark) in the for
loop. I was wondering what the ?
does?
<script type="text/javascript">
n=317584931803;
for(i=2;n>1;n%i?i++:(n/=i,document.write(i+' ')));
</script>
And, if you can also explain what exactly this script does, I'd appreciate it.