如何划分列表中的特定数字?

How to divide a specific number in a list?

梅森素数遵循这个公式 2^n-1。我为不产生梅森素数的数字创建了一种新型因式分解方法。这是非常抽象的。它的前提是如果使用 mod 公式应用特定数字并且新数字变为(零),则它不是梅森素数。我在线向 The Journal of Number Theory 投了一篇论文,但是被期刊拒绝了。我已经附上了,如果你想看的话,我仍然觉得我的方法很有前途,但我不是编码专家。 This is a pdf I sent to the Journal of Number Theory 我的问题是在我的新代码中我不知道如何除以数字在列表中。该列表枚举正常,但我想从 253 中减去 z=11,它等于 242,而不是 mod 减去 121,但是当我创建 1-254 的范围时,我似乎无法进行此数学计算。我对此感兴趣的原因是 253//11=23,它是 2^11-1 的因数。我从比率页面得到这个想法。

键入 1:11,第二个数字是 22,只需加上 1 和它的 23。

看看 https://goodcalculators.com/ratio-calculator/

该公式将以范围内的任何数字为目标,而我要查找的是零。

根据要求提供 grismar 的其他详细信息:

Grismar 等人,

我发现,与 2^11-1 这样的数字相比,梅森素数在数字 11 以下产生的零更少。此外,当您通过减去 z 然后 mod z*z 输出数字时,您可能会在除以 z 后找到其中因子最低的数字。范围必须足够大才能找到该数字,但如果为零,则只需除以 z。然后,例如,当您通过将 11 除以 253 得到 23 时。您可以将 23 除以 2047,您应该得到 89。如果您使用不同的数字来检查这个因数,您很可能会得到一个分数。因此,当您使用此方法进行检查时,发现一个数字为零,而该数字不会产生梅森素数之类的数字。让我们选择 29。536870911 ÷ 233 = 2304167 所以你得到一个因子数而不是分数。

这些都是536870911的因数 [1, 233, 1103, 256999, 2089, 486737, 2304167, 536870911]

如果您想了解更多详情,请发表评论。

程序员在学习求助这里是我的程序: 1应该是起始范围!

    while True:
        x = int(input("Use 1 for the start range to make this work correctly: 
    "))
        i = int(input("End Range: "))
        z = int(input("square of  primes multiplied by a number plus z which 
    does not make a 
    mersenne prime, this finds its factor of z: "))
        fact = [(i + 1, x) for i, x in enumerate(range(x, i))]



    print([((int(i)-z) % (z*z)) if isinstance(i, str) else i for i in fact])

也许您正在尝试的是这个,int 调用是不必要的,因为值从一开始就是 integers。另外,不要将相同的变量 i 用于不同的目的:

calculations = [
    (index + 1, (fact_tuple[0] - z) % (z*z)) for index, fact_tuple in enumerate(fact)
]
print(calculations) # with x = 1, i = 254, z = 11
>>> [(1, 111), (2, 112), (3, 113), (4, 114), (5, 115), (6, 116), (7, 117), (8, 118), (9, 119), (10, 120), (11, 0), (12, 1), (13, 2), (14, 3), (15, 4), (16, 5), (17, 6), (18, 7), (19, 8), (20, 9), (21, 10), (22, 11), (23, 12), (24, 13), (25, 14), (26, 15), (27, 16), (28, 17), (29, 18), (30, 19), (31, 20), (32, 21), (33, 22), (34, 23), (35, 24), (36, 25), (37, 26), (38, 27), (39, 28), (40, 29), (41, 30), (42, 31), (43, 32), (44, 33), (45, 34), (46, 35), (47, 36), (48, 37), (49, 38), (50, 39), (51, 40), (52, 41), (53, 42), (54, 43), (55, 44), (56, 45), (57, 46), (58, 47), (59, 48), (60, 49), (61, 50), (62, 51), (63, 52), (64, 53), (65, 54), (66, 55), (67, 56), (68, 57), (69, 58), (70, 59), (71, 60), (72, 61), (73, 62), (74, 63), (75, 64), (76, 65), (77, 66), (78, 67), (79, 68), (80, 69), (81, 70), (82, 71), (83, 72), (84, 73), (85, 74), (86, 75), (87, 76), (88, 77), (89, 78), (90, 79), (91, 80), (92, 81), (93, 82), (94, 83), (95, 84), (96, 85), (97, 86), (98, 87), (99, 88), (100, 89), (101, 90), (102, 91), (103, 92), (104, 93), (105, 94), (106, 95), (107, 96), (108, 97), (109, 98), (110, 99), (111, 100), (112, 101), (113, 102), (114, 103), (115, 104), (116, 105), (117, 106), (118, 107), (119, 108), (120, 109), (121, 110), (122, 111), (123, 112), (124, 113), (125, 114), (126, 115), (127, 116), (128, 117), (129, 118), (130, 119), (131, 120), (132, 0), (133, 1), (134, 2), (135, 3), (136, 4), (137, 5), (138, 6), (139, 7), (140, 8), (141, 9), (142, 10), (143, 11), (144, 12), (145, 13), (146, 14), (147, 15), (148, 16), (149, 17), (150, 18), (151, 19), (152, 20), (153, 21), (154, 22), (155, 23), (156, 24), (157, 25), (158, 26), (159, 27), (160, 28), (161, 29), (162, 30), (163, 31), (164, 32), (165, 33), (166, 34), (167, 35), (168, 36), (169, 37), (170, 38), (171, 39), (172, 40), (173, 41), (174, 42), (175, 43), (176, 44), (177, 45), (178, 46), (179, 47), (180, 48), (181, 49), (182, 50), (183, 51), (184, 52), (185, 53), (186, 54), (187, 55), (188, 56), (189, 57), (190, 58), (191, 59), (192, 60), (193, 61), (194, 62), (195, 63), (196, 64), (197, 65), (198, 66), (199, 67), (200, 68), (201, 69), (202, 70), (203, 71), (204, 72), (205, 73), (206, 74), (207, 75), (208, 76), (209, 77), (210, 78), (211, 79), (212, 80), (213, 81), (214, 82), (215, 83), (216, 84), (217, 85), (218, 86), (219, 87), (220, 88), (221, 89), (222, 90), (223, 91), (224, 92), (225, 93), (226, 94), (227, 95), (228, 96), (229, 97), (230, 98), (231, 99), (232, 100), (233, 101), (234, 102), (235, 103), (236, 104), (237, 105), (238, 106), (239, 107), (240, 108), (241, 109), (242, 110), (243, 111), (244, 112), (245, 113), (246, 114), (247, 115), (248, 116), (249, 117), (250, 118), (251, 119), (252, 120), (253, 0)]