User blog comment:DrCocktor/Another question related to maths in general/@comment-32994025-20190504231649/@comment-32994025-20190505010447

Fixed code so it doesn't cause stack overflow.

bound=10000;for(n=0;n<=bound;n++){q=n;for(i=3;i;i--){c=0;for(d=q;d;d--)if(n%d==0)c+=d;q=c};if(q==n*2)console.log(n)}