Comment detail

2^i * 3^j * 5^k なる整数 (Nested Flatten)

Javascript@Firebug。 n2,n3,n5の最大値は試行錯誤で決めてます

1
2
3
4
5
6
7
8
var o={};
for(var n2=0; n2<=11; n2++)
  for(var n3=0; n3<=8; n3++)
    for(var n5=0; n5<=7; n5++)
      o[Math.pow(2,n2)*Math.pow(3,n3)*Math.pow(5,n5)] = [n2,n3,n5];
for(var i=0,c=0;c<100;i++)
  if(o[i]!=null)
    console.debug(++c, ". ", i, "= 2^", o[i][0], " + 3^", o[i][1], " + 5^", o[i][2]);

Index

Feed

Other

Link

Pathtraq

loading...