Hi. I'm trying to generate a list of pairs of primes (x,y) within a range of values such that the digit length of their products is between 19 and 35. I've written a few different code variations that (unfortunately) either (1) generate ALL the integer pairs (that equal 19, 20, 21, etc.) or (2) never seem to halt.
I really want the iteration to be as follows: find the first pair that equals 19, then locate the first pair that equals 20, and so on so until I have one list of 17 pairs of primes---one pair for each digit length. Here's what I have so far: x=var('x') y=var('y') for x in sxrange (10**9,10**(36)): for y in sxrange (961748941,982451653): if x.is_prime()==1 and y.is_prime()==1: if (floor(log((x*y),10)+1)<=35)==1: print(x,y); print(floor(log((x*y),10)+1); break Then I tried defining y=982451653 so I could use only one iterable using the following code: for x in sxrange (10**9,10**(36)): if x.is_prime()==1: if (floor(log((x*y),10)+1)>=19)==1: continue print(x,y); print(floor(log((x*y),10)+1); break which returns only one value: 1000000007 982451653 18 Sorry for the n00b post. I've only been using Sage for three days. Thanks, David -- You received this message because you are subscribed to the Google Groups "sage-support" group. To unsubscribe from this group and stop receiving emails from it, send an email to sage-support+unsubscr...@googlegroups.com. To view this discussion on the web visit https://groups.google.com/d/msgid/sage-support/eeca56a4-7521-4125-8264-911efb83777b%40googlegroups.com.