Ask Your Question

Sam_Na's profile - activity

2023-06-17 08:37:42 +0200 received badge  Famous Question (source)
2023-01-22 00:13:13 +0200 received badge  Notable Question (source)
2023-01-22 00:13:13 +0200 received badge  Popular Question (source)
2020-05-04 19:56:34 +0200 answered a question SyntaxError

Ahh thank you very much. It worked well!! :D Okay now I'm thinking of doing a kind of list to get the is_prime() in range(1,41) for both a and b. So I have a list like True True False . . . Till 41

Do you have any tips to create a list like that? :) Thank you very much

2020-05-04 13:22:34 +0200 received badge  Editor (source)
2020-05-04 13:21:39 +0200 received badge  Supporter (source)
2020-05-04 13:21:34 +0200 answered a question SyntaxError

Thanks for your answer. I am looking for a quadratic polynomial f(n)=n^2+a*x+b with a and b from the natural numbers. so when I write if f(n) in ZZ I'm trying to get the natural numbers
f(n) should then give me only prime numbers for all n values between 1 and 40. So I'm not sure if I have to define a and b to beZZ? Thanks a lot :)

2020-05-03 15:16:07 +0200 received badge  Student (source)
2020-05-03 14:54:42 +0200 asked a question SyntaxError

Hello everyone, I'using Sage for three weeks now and I got a problem.I have been looking for the error in this code for about 3 days and I can't figure it out. Maybe you can help me :)

var("a,b,n")
f(n)=n^2+a*n+b:
for a in range(1,41):
for b in range(1,41):
if f(n) in ZZ
for n in range(0,41)
if is_prime(f(n)):
print(a); print(b)

I'm getting the error:

__tmp__=var("n"); f = symbolic_expression(n**Integer(2)+a*n+b:).function(n)
                                                                 ^
SyntaxError: invalid syntax

I hope you can help me :)