2016年9月17日土曜日

160917(2)

Ruby


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

E: y^2 + a1*x*y + a3*y = x^3 + a2*x^2 + a4*x + a6
のa1 = 0 のときを考える。
このとき、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 = 100
p A(1, -1, -10, -20, n) # 最初の項だけA272196と異なる
p A(0,  1,   4,   4, n)
p A(0, -1,  -4,   4, n)
p A(1,  0,   0,  -7, n)
p A(0,  0,   4,   0, n)
p A(0,  0,   0,   1, n)
p A(0,  1,  -4,  -4, n)
p A(0,  0,  -4,   0, n)
p A(0, -1,   4,  -4, n)
p A(0,  0,   0,  -1, n)

出力結果
[4, 4, 4, 9, 10, 9, 19, 19, 24, 29, 24, 34, 49, 49, 39, 59, 54, 49, 74, 74, 69, 89, 89, 74, 104, 99, 119, 89, 99, 104, 119, 149, 144, 129, 159, 149, 164, 159, 179, 179, 194, 174, 174, 189, 199, 199, 199, 204, 209, 214, 209, 269, 249, 274, 259, 249, 259, 299, 279, 299, 279, 269, 299, 299, 314, 304, 324, 359, 319, 319, 374, 379, 384, 399, 384, 384, 404, 399, 399, 439, 399, 399, 449, 444, 399, 454, 414, 469, 449, 474, 494, 459, 464, 499, 479, 529, 494, 524, 539, 549]
[2, 5, 6, 5, 11, 11, 23, 23, 17, 23, 35, 35, 35, 53, 53, 59, 47, 59, 65, 83, 71, 71, 77, 95, 95, 95, 89, 113, 107, 119, 125, 131, 119, 143, 155, 131, 179, 173, 149, 179, 191, 191, 203, 167, 179, 191, 227, 233, 233, 215, 239, 263, 227, 251, 263, 281, 251, 251, 251, 275, 269, 323, 305, 299, 335, 323, 323, 335, 377, 359, 335, 335, 389, 347, 407, 377, 395, 395, 431, 443, 383, 395, 395, 431, 431, 437, 443, 431, 431, 449, 497, 503, 461, 491, 503, 521, 503, 527, 509, 527]
[2, 4, 7, 7, 7, 15, 15, 23, 31, 23, 23, 31, 47, 39, 47, 55, 55, 63, 71, 63, 63, 87, 87, 95, 95, 119, 87, 119, 111, 95, 135, 135, 143, 151, 135, 167, 159, 151, 143, 167, 167, 175, 191, 191, 215, 183, 231, 231, 215, 207, 223, 255, 223, 231, 255, 271, 279, 263, 303, 255, 311, 311, 295, 335, 319, 311, 311, 319, 359, 319, 351, 383, 375, 383, 359, 383, 391, 383, 431, 415, 407, 431, 399, 447, 439, 423, 463, 479, 487, 455, 503, 495, 519, 503, 487, 479, 503, 495, 519, 559]
[2, 3, 5, 8, 11, 8, 17, 26, 23, 29, 35, 26, 41, 35, 47, 53, 59, 62, 62, 71, 80, 62, 83, 89, 116, 101, 116, 107, 107, 113, 107, 131, 137, 116, 149, 170, 143, 188, 167, 173, 179, 188, 191, 170, 197, 188, 224, 251, 227, 251, 233, 239, 224, 251, 257, 263, 269, 242, 251, 281, 251, 293, 323, 311, 278, 317, 332, 332, 347, 386, 353, 359, 332, 386, 350, 383, 389, 431, 401, 440, 419, 440, 431, 431, 467, 443, 449, 467, 461, 440, 467, 479, 512, 491, 467, 503, 509, 521, 566, 512]
[2, 3, 7, 7, 11, 7, 15, 19, 23, 39, 31, 39, 31, 43, 47, 39, 59, 71, 67, 71, 79, 79, 83, 79, 79, 103, 103, 107, 103, 127, 127, 131, 159, 139, 135, 151, 135, 163, 167, 199, 179, 199, 191, 207, 199, 199, 211, 223, 227, 199, 207, 239, 271, 251, 255, 263, 295, 271, 295, 271, 283, 327, 307, 311, 287, 295, 331, 319, 347, 359, 319, 359, 367, 359, 379, 383, 423, 359, 399, 415, 419, 391, 431, 399, 439, 443, 463, 415, 423, 463, 467, 479, 487, 491, 499, 503, 519, 543, 523, 583]
[2, 3, 5, 11, 11, 11, 17, 11, 23, 29, 35, 47, 41, 35, 47, 53, 59, 47, 83, 71, 83, 83, 83, 89, 83, 101, 83, 107, 107, 113, 107, 131, 137, 155, 149, 155, 143, 155, 167, 173, 179, 155, 191, 191, 197, 227, 227, 251, 227, 251, 233, 239, 227, 251, 257, 263, 269, 299, 251, 281, 251, 293, 323, 311, 335, 317, 299, 371, 347, 335, 353, 359, 371, 335, 371, 383, 389, 431, 401, 371, 419, 443, 431, 431, 467, 443, 449, 467, 461, 443, 467, 479, 443, 491, 467, 503, 509, 521, 515, 587]
[2, 2, 7, 7, 15, 15, 15, 15, 15, 23, 39, 31, 47, 47, 47, 55, 63, 63, 63, 79, 63, 71, 79, 95, 95, 119, 119, 95, 111, 95, 119, 127, 143, 127, 135, 135, 159, 175, 191, 167, 191, 175, 191, 191, 215, 215, 191, 215, 239, 207, 223, 223, 223, 271, 255, 255, 279, 279, 303, 255, 255, 311, 319, 287, 319, 311, 351, 319, 335, 319, 351, 335, 359, 383, 399, 383, 391, 383, 431, 415, 431, 431, 463, 447, 439, 463, 463, 479, 487, 471, 431, 463, 455, 479, 511, 527, 503, 495, 527, 559]
[2, 3, 3, 7, 11, 19, 15, 19, 23, 19, 31, 35, 31, 43, 47, 67, 59, 51, 67, 71, 79, 79, 83, 79, 79, 99, 103, 107, 115, 127, 127, 131, 159, 139, 163, 151, 179, 163, 167, 147, 179, 163, 191, 207, 195, 199, 211, 223, 227, 259, 207, 239, 271, 251, 255, 263, 243, 271, 259, 271, 283, 259, 307, 311, 287, 339, 331, 319, 347, 339, 319, 359, 367, 387, 379, 383, 355, 435, 399, 415, 419, 451, 431, 399, 439, 443, 463, 415, 499, 463, 467, 479, 487, 491, 499, 503, 499, 543, 523, 499]
[2, 1, 6, 9, 11, 11, 23, 15, 29, 23, 27, 35, 35, 33, 41, 59, 71, 59, 69, 59, 71, 87, 89, 95, 95, 95, 117, 101, 107, 119, 129, 131, 119, 135, 155, 171, 179, 153, 185, 179, 167, 191, 179, 167, 179, 207, 195, 213, 221, 215, 239, 215, 227, 251, 263, 245, 251, 291, 251, 275, 297, 323, 309, 323, 335, 323, 339, 335, 317, 359, 335, 383, 345, 347, 351, 389, 395, 395, 431, 443, 455, 395, 467, 431, 447, 449, 443, 431, 431, 477, 437, 455, 513, 491, 495, 485, 503, 527, 537, 527]
[2, 3, 5, 3, 11, 11, 17, 27, 23, 29, 27, 47, 41, 51, 47, 53, 59, 47, 51, 71, 83, 75, 83, 89, 83, 101, 123, 107, 107, 113, 147, 131, 137, 123, 149, 147, 143, 171, 167, 173, 179, 155, 191, 191, 197, 171, 195, 195, 227, 251, 233, 239, 227, 251, 257, 263, 269, 243, 251, 281, 315, 293, 291, 311, 335, 317, 363, 371, 347, 335, 353, 359, 363, 335, 387, 383, 389, 431, 401, 371, 419, 443, 431, 431, 411, 443, 449, 467, 461, 483, 467, 479, 531, 491, 531, 503, 509, 521, 531, 587]

0 件のコメント:

コメントを投稿