1
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

More than 5 years have passed since last update.

pを法とする楕円曲線の解の個数

Last updated at Posted at 2015-08-22
<!DOCTYPE html>
<html lang="ja">
<head>
<meta charset="UTF-8">
<title>Fermat Last Theorem</title>
<script>

(function(){
	//f(x)=x^3-x
	function f(x){
		return Math.pow(x,3)-x;
	};

	//P_maxまでの素数を求めてpに入れる
	const P_MAX=100;
	var p=[];
	prime();
	const P=p.length

	var N_p=[];//素数pごとの解の個数

	//p[i]はi番目の素数
	for(var i=0;i<P;i++){
		var count = 0;
		for(var j=0;j<p[i];j++){
			var yy=f(j)%p[i]//右辺 mod p

			//√yyだけでなく√(yy+kp)についても解になるか考える
			for(var k=0;Math.sqrt(yy+k*p[i])<p[i];k++){
				var y=Math.sqrt(yy+k*p[i]);
				if(y%1==0){
					count++;//yが整数なら解として数える
				};
			};
		};
		N_p[i]=count;
	};
	console.log("p  :"+p);
	console.log("N_p:"+N_p);


	//素数を求める関数
	function prime(){
		p=[2,3]
		for(var i=5;i<P_MAX;i=i+2){
			var flag=0;
			for(var j=3;j<i/2;j=j+2){
				if(i%j==0){
					flag=1;
					break;
				};
			};
			if(flag==0){
				p.push(i)
			};
		};
	}

})();
</script>
</head>
<body>
</body>
</html>
1
0
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
1
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?