# How do I get that sage prints me out some item

I have the following code:

      sage:R.<x>=QQ[]
f=x^2-x+6
K.<a>=NumberField(f)
cl = K.class_group()
L=K.ideal(23)
S=ideal(4,a+1)
S.is_integral()
sage: for norm, ideals in K.ideals_of_bdd_norm(50).items():
for J in ideals:
for N in range(5):
if (J.is_coprime(L*N)):
if(J!=cl.one()):
if(4*J.norm()-1 in L*N):
print norm,J,N


The output is :

True
6 Fractional ideal (6, a + 2) 1
6 Fractional ideal (a - 1) 1
6 Fractional ideal (a) 1
6 Fractional ideal (6, a + 3) 1
29 Fractional ideal (29, a + 18) 1
29 Fractional ideal (29, a + 10) 1


What do I have to do to only get the item 29 Fractional ideal (29, a + 18) 1 ?

edit retag close merge delete

Can you provide more information? How, computationally or programmatically or mathematically, do you want to choose which item to print/return?

( 2020-06-09 23:13:35 +0200 )edit

I only want to know whether there is a command to select a specific item for example 29 Fractional ideal (29, a + 18) 1.

( 2020-06-10 00:14:20 +0200 )edit

Sort by ยป oldest newest most voted

sage: for a in [0,1,2]:
....:     print(a**2)
....:
0
1
4


do

sage: L = []
sage: for a in [0,1,2]:
....:     L.append(a**2)
....:
sage: L
[0, 1, 4]


Then you have access to the list L, you can pick and choose elements from it, etc. For example:

sage: L[2]
4

more