2016年10月1日土曜日

161001(2)

Ruby


p を法とする楕円曲線上の点の数(3)

y^2 + y = x^3 - x^2 - 40x - 221,
y^2 + y = x^3 - x^2 - 1250x + 31239,
y^2 + y = x^3 - x^2 - 946260x + 354609639

これらについて、p を法とする楕円曲線上の点の数を求め、
それぞれが一致することを確認してみた。

y^2 + y = x^3 - x^2 - 7x + 10,
y^2 + y = x^3 - x^2 - 887x - 10143

またこれらについても、p を法とする楕円曲線上の点の数を求め、
それぞれが一致することを確認してみた。

require 'prime'

def A(a3, a2, a4, a6, n)
  ary = []
  Prime.take(n).each{|p|
    a = Array.new(p, 0)
    (0..p - 1).each{|i| a[(i * i + a3 * i) % p] += 1}
    ary << (0..p - 1).inject(0){|s, i| s + a[(i * i * i + a2 * i * i + a4 * i + a6) % p]}
  }
  ary
end

n = 500
p ary = A(1, -1, -40, -221, n)
p ary == A(1, -1,   -1250,     31239, n)
p ary == A(1, -1, -946260, 354609639, n)

p ary = A(1, -1, -7, 10, n)
p ary == A(1, -1, -887, -10143, n)

出力結果
[0, 4, 4, 5, 11, 17, 15, 19, 24, 29, 24, 34, 33, 37, 39, 59, 54, 73, 74, 74, 77, 69, 77, 74, 104, 103, 119, 125, 119, 104, 135, 113, 144, 149, 139, 153, 164, 159, 155, 167, 194, 174, 174, 197, 195, 199, 223, 204, 245, 214, 257, 209, 233, 274, 259, 277, 259, 243, 275, 263, 287, 317, 315, 299, 314, 304, 324, 315, 375, 379, 374, 339, 384, 347, 384, 384, 404, 399, 399, 379, 399, 399, 413, 444, 479, 454, 414, 445, 473, 474, 494, 499, 464, 483, 479, 477, 494, 524, 507, 533, 555, 555, 567, 569, 543, 544, 559, 637, 559, 603, 585, 597, 599, 644, 624, 674, 614, 654, 694, 669, 624, 687, 635, 699, 674, 703, 734, 704, 724, 697, 789, 747, 774, 779, 773, 789, 779, 755, 744, 809, 773, 843, 784, 775, 804, 844, 867, 865, 874, 839, 865, 924, 879, 865, 919, 899, 929, 959, 945, 983, 974, 987, 935, 924, 1004, 944, 999, 1035, 999, 974, 1009, 999, 1063, 1017, 1034, 1104, 1053, 1074, 1107, 1049, 1079, 1033, 1144, 1055, 1154, 1139, 1165, 1099, 1179, 1153, 1184, 1197, 1174, 1199, 1175, 1214, 1203, 1254, 1175, 1237, 1289, 1213, 1219, 1289, 1284, 1324, 1294, 1247, 1289, 1299, 1345, 1274, 1264, 1279, 1289, 1274, 1395, 1373, 1439, 1334, 1313, 1459, 1424, 1394, 1415, 1359, 1379, 1439, 1475, 1503, 1524, 1439, 1493, 1513, 1434, 1545, 1504, 1457, 1444, 1474, 1564, 1563, 1579, 1564, 1497, 1499, 1619, 1599, 1549, 1617, 1565, 1603, 1574, 1619, 1607, 1599, 1599, 1705, 1604, 1655, 1667, 1715, 1719, 1687, 1739, 1659, 1754, 1724, 1677, 1727, 1724, 1804, 1719, 1719, 1785, 1724, 1844, 1799, 1853, 1823, 1767, 1874, 1795, 1923, 1895, 1874, 1879, 1895, 1914, 1959, 1824, 1959, 1877, 1913, 1987, 1909, 1974, 1894, 2009, 1965, 1927, 1925, 1979, 1999, 2024, 2034, 1964, 1984, 1979, 2137, 2087, 1999, 2063, 1994, 2135, 2079, 2064, 2073, 2199, 2149, 2063, 2064, 2083, 2234, 2127, 2174, 2224, 2204, 2255, 2217, 2243, 2159, 2169, 2187, 2203, 2174, 2244, 2277, 2274, 2325, 2264, 2354, 2369, 2324, 2274, 2349, 2274, 2384, 2303, 2414, 2343, 2374, 2399, 2347, 2339, 2447, 2474, 2473, 2395, 2454, 2355, 2483, 2444, 2409, 2464, 2484, 2525, 2517, 2593, 2474, 2539, 2577, 2529, 2453, 2544, 2559, 2533, 2607, 2579, 2635, 2599, 2594, 2685, 2695, 2699, 2624, 2599, 2684, 2667, 2664, 2684, 2734, 2754, 2724, 2624, 2657, 2649, 2699, 2799, 2683, 2799, 2704, 2815, 2819, 2769, 2833, 2839, 2853, 2759, 2844, 2827, 2775, 2839, 2853, 2775, 2924, 2839, 2944, 2859, 2957, 2934, 3005, 2999, 2889, 3039, 2954, 3044, 3039, 3024, 2919, 2974, 3073, 2934, 2984, 3024, 2999, 3009, 3024, 3054, 3059, 3054, 3064, 3189, 3029, 3143, 3145, 3137, 3185, 3124, 3213, 3185, 3199, 3197, 3199, 3194, 3324, 3299, 3203, 3327, 3199, 3319, 3274, 3399, 3374, 3405, 3317, 3319, 3399, 3229, 3374, 3387, 3364, 3404, 3273, 3474, 3377, 3374, 3299, 3425, 3404, 3499, 3489, 3514, 3423, 3559, 3505, 3554, 3474, 3399, 3523, 3495, 3545, 3564, 3557, 3559, 3583, 3494, 3584, 3559, 3543]
true
true
[2, 4, 8, 7, 11, 13, 17, 19, 32, 29, 36, 30, 41, 43, 59, 47, 74, 61, 54, 74, 73, 79, 83, 98, 80, 101, 107, 107, 109, 92, 127, 131, 140, 139, 149, 151, 180, 179, 167, 173, 158, 206, 206, 193, 197, 219, 211, 224, 227, 234, 233, 239, 241, 278, 239, 263, 239, 271, 277, 281, 283, 293, 307, 323, 294, 344, 296, 337, 347, 349, 362, 359, 404, 373, 404, 344, 404, 395, 371, 409, 395, 411, 431, 404, 439, 422, 410, 457, 461, 494, 470, 479, 444, 491, 459, 503, 554, 536, 523, 541, 547, 557, 563, 569, 571, 624, 635, 593, 635, 601, 607, 613, 659, 620, 624, 686, 602, 674, 602, 659, 648, 673, 677, 659, 674, 701, 690, 668, 780, 733, 739, 743, 774, 795, 761, 769, 719, 787, 800, 809, 811, 821, 872, 827, 800, 884, 853, 857, 890, 899, 877, 824, 939, 887, 899, 971, 919, 899, 937, 941, 890, 953, 967, 1016, 1004, 932, 1011, 997, 1009, 1022, 1019, 971, 1031, 1033, 998, 1064, 1051, 998, 1063, 1069, 1059, 1091, 1152, 1097, 1082, 1103, 1117, 1187, 1129, 1151, 1092, 1163, 1218, 1163, 1187, 1262, 1201, 1214, 1217, 1223, 1229, 1231, 1295, 1249, 1328, 1220, 1214, 1283, 1289, 1251, 1297, 1346, 1284, 1235, 1319, 1374, 1327, 1361, 1379, 1334, 1381, 1399, 1484, 1394, 1427, 1429, 1379, 1499, 1447, 1451, 1484, 1459, 1471, 1481, 1554, 1487, 1548, 1493, 1544, 1526, 1592, 1531, 1467, 1488, 1553, 1559, 1515, 1499, 1579, 1583, 1597, 1601, 1550, 1599, 1613, 1619, 1691, 1627, 1664, 1657, 1663, 1667, 1669, 1693, 1775, 1779, 1790, 1724, 1723, 1733, 1808, 1664, 1779, 1759, 1777, 1704, 1724, 1789, 1801, 1811, 1823, 1746, 1847, 1861, 1867, 1946, 1907, 1877, 1950, 1889, 1928, 1955, 1913, 1931, 1933, 1949, 1878, 2054, 1979, 1987, 1993, 1997, 1999, 1979, 2016, 2010, 1940, 1944, 1955, 2053, 2063, 1979, 2081, 2142, 2087, 2089, 2060, 2111, 2067, 2129, 2131, 2160, 2141, 2082, 2153, 2186, 2100, 2292, 2207, 2213, 2221, 2219, 2239, 2243, 2251, 2210, 2204, 2273, 2186, 2287, 2384, 2390, 2309, 2276, 2342, 2339, 2258, 2384, 2351, 2270, 2371, 2474, 2351, 2383, 2389, 2393, 2474, 2411, 2417, 2402, 2437, 2441, 2384, 2459, 2424, 2544, 2477, 2503, 2521, 2474, 2555, 2543, 2549, 2551, 2604, 2483, 2591, 2593, 2609, 2617, 2699, 2714, 2647, 2657, 2659, 2672, 2643, 2780, 2683, 2600, 2780, 2654, 2714, 2760, 2648, 2713, 2719, 2639, 2699, 2741, 2749, 2732, 2767, 2879, 2789, 2791, 2699, 2801, 2907, 2864, 2833, 2837, 2747, 2851, 2857, 2936, 2879, 2780, 2879, 2903, 2978, 2917, 3035, 2939, 2879, 3050, 2912, 2969, 3068, 2999, 3006, 3011, 2934, 2984, 3024, 3011, 3049, 2996, 3050, 3079, 3194, 2984, 3109, 3119, 3121, 3137, 3163, 3167, 3068, 3181, 3187, 3299, 3203, 3209, 3330, 3116, 3229, 3251, 3253, 3299, 3315, 3374, 3299, 3266, 3307, 3313, 3319, 3299, 3329, 3446, 3343, 3260, 3440, 3361, 3374, 3373, 3398, 3491, 3407, 3524, 3519, 3449, 3414, 3461, 3347, 3467, 3374, 3374, 3563, 3511, 3517, 3527, 3644, 3533, 3539, 3541, 3594, 3440, 3559, 3571]
true

0 件のコメント:

コメントを投稿

注: コメントを投稿できるのは、このブログのメンバーだけです。