Ask Your Question

# What broke?

This code worked in Sage 4.8 and I show it working in the Sage Cell server back in July:

@interact
def _GoldbachConj(Number = slider(4,600,2,4, label="Number"),FigureSize =  slider([1..21],default = 9, label="figure size"),Calculation = selector(['check one number','all numbers up to a number'],default = 'check one number', label = "Calculation choice")):
html('<h2 align=center>%s</h2>'%"Goldbach's Conjecture")
if (Calculation=='check one number'):
for i in range(2,Number/2+1):
if is_prime(i) and is_prime(Number-i):
print i, " + ", Number-i, " = ", Number
elif (Calculation=='all numbers up to a number'):
for i in range(4,Number+1,2):
for j in range(2,i/2+1):
if (is_prime(j) and is_prime(i-j)):
print j, " + ", i-j, " = ", i This code no longer works for the current Sage Cell server, giving an error message for invalid syntax (line 2). What's broken and how do I fix it?

edit retag close merge delete

## Comments

If you can edit the question title to something more informative, it might help other folks who run into the same problem down the road.

## 1 Answer

Sort by » oldest newest most voted

The problem (which is definitely a regression on our end), is stemming from FigureSize using a generator for a list.

For now, if you change the relevant portion to:

FigureSize =  slider([i +1 for i in xrange(20)], default = 9, label="figure size")


the code works as expected. I've opened a bug report here: https://github.com/sagemath/sagecell/...

more

## Your Answer

Please start posting anonymously - your entry will be published after you log in or create a new account.

Add Answer

## Stats

Asked: 2012-09-23 12:23:04 +0200

Seen: 324 times

Last updated: Sep 23 '12