#code running for so long

6 messages · Page 1 of 1 (latest)

grave thorn
#

Hi everyone
I actually run a code on vscode but it take too long
Here the code:
n = 50 while n<=500 : k=0 while k<n: S1=(k*(k+1))/2 k=k+1 S2=((n*(n+1))/2)-((k*(k+1))/2) if S1==S2 : print("Pour un nombres",n,"de maisons, la maison de ramanoujan est la",k) n=n+1
thx
it's been running since 2H+

sweet chasm
#

because you both increase k and n in the inner loop

#

it will never finish running

#

pull the last line out one indent

peak saffron
#

Im more curious why u thought leaving it on for 2+ hours would help

sweet chasm
#

hes a patient one (or having a super low-end device)