Sharedmersenne_loose_public.sagewsOpen in CoCalc
Author: Gary Wright
Views : 21
Description: Sagecloud version of November 2009 Mersenne like sagenb.org script
# Most Positive Integers of the form -1+2**n are Composite rather than Prime # # There is no significance to the range of numbers 7 through 37 # I selected that range so the primality test is_prime would not # take too long. # # There are more than Mersenne Composites and Mersenne Primes generated by this # loop. For example 8 gives -1+2**8 = 255 which is not a Mersenne Composite # nor a Mersenne Prime. # # Expect many Falses and just a few Trues (Mersenne Primes) in the output. # for n in range(7,37): mn=-1+2**n print mn, is_prime(mn) # True and False are intended to indicate if the number is Prime # False indicates that the preceding number is a Composite
127 True 255 False 511 False 1023 False 2047 False 4095 False 8191 True 16383 False 32767 False 65535 False 131071 True 262143 False 524287 True 1048575 False 2097151 False 4194303 False 8388607 False 16777215 False 33554431 False 67108863 False 134217727 False 268435455 False 536870911 False 1073741823 False 2147483647 True 4294967295 False 8589934591 False 17179869183 False 34359738367 False 68719476735 False