2014-12-09 åé¨çå¿æ´ï¼Javascriptã§ã²ãããæ°åï¼(KMCã¢ããã³ãã«ã¬ã³ãã¼9æ¥ç®) ã»å§ãã« ãã¯ãããããã¾ãï¼ KMC1åçãid:murataã¨ç³ãã¾ãï¼ ãã®è¨äºã¯KMC Advent Calendar 2014ã®9æ¥ç®ã®è¨äºã§ãã æ¨æ¥ã¯yui9ããã® ãHaskellã§ç°¡åãªæ£è¦è¡¨ç¾ãå®è£ ãããã§ããã ç§ã¯ã¾ã ã¾ã æªçãªã®ã§ é å» ã® KMC ã® è¨ äº ã¿ãããªé«åº¦ãªå 容ãæ¸ãã¯ãã¾ããããã容赦ä¸ããã¾ãã  ã»ã²ãããæ°å ãããã12æã§ããã ã¯ãªã¹ãã¹ ã¨ãããã£ã¦ãããã»ã³ã¿ã¼è©¦é¨ãªãããè¿ã¥ãã¦ããææã§ã¯ãªãã§ããããã ç¹ã«ã大å¦åé¨ããããæ¹ã ã¯ãæ°åãããã¨ããã»ã©è¦ã¦ãããã¨æãã¾ãã é«æ ¡2å¹´çã®æ¹ã ã¯ä»é ã®ãã¹ãç¯å²ãæ°åã ã£ããã¨ãããããã¨æãã¾ãã 1,2,4,8,...ã®ä¸è¬é ãæ±ãããã¨ã 1,1,2,3,5,8,13,21,34,55...ã®ä¸è¬é ãæ±ãããã¨ã 1,4,27,256,...ã®ä¸è¬é ãæ±ãããã¨ãããããã°ããããªãã»ã©ã§ãã é«æ ¡çã®æã®åã¯æã£ã¦ãã¾ããã 1,2,4,8,...ã®ãããªæ°åã¯ãå¥ã«1,2,4,8,ãããã£ã¦ããã°å½ç¶ãå¾ã¯ä½ã§ãããã¯ãã ã¨ã ãããããã¹ãã§æ¸ãã¨ãã«ã¯ä¸è¬é ã¯An=2(n-1)ä½ããããã«ã¯æãã¤ããªããã ãã¶ãã¶ãã®ä¸è¬é ãæ¸ããããªãã®ã ã¨ã ãããªçµé¨ã«ã¯ãããµã¨ãã©ã§ãï¼ ãã®Javascriptã§æ¸ãããããã°ã©ã ã¯ããããªã²ããããããªãããµãã¼ããã¾ãï¼ ä½ãã¯ç°¡åã§ã大å¦ã®è¬ç¾©ã§n次å ã®éè¡åã®ä½ãæ¹ãç¿ã£ãã®ã§ãããå®è£ ãããã®ã§ãã ä¾ãã° 1,2,4,8,...ã®ä¸è¬é ã¯ã2(n-1)ã§ã¯ãªãã¦ãã²ããããã° 4/3n-1/2n2+1/6n3ãã¨ããããã 1,1,2,3,5,8,13,21,34,55...ã®ä¸è¬é ã¯ããã£ããããæ°åã§ãªãã¦ã²ããããã° 9581/504n-455473/10080n2+8148799/181440n3-8774477/362880n4 +271847/34560n5-55883/34560n6+25589/120960n7-1033/60480n8+563/725760n9-11/725760n10 ã¨ããããããã§ã ããæ¸ãã¦ãå çã¯ãããã¤ããããªãããã§ãã ããããããã¯Javascriptã§ããããçæ¡ä¸ã«ãµãã¨ã¹ããã§éãã¦å ¥åããã° çããå¾ãããããã§ãã   ã»èª¬æ n1,n2,n3,n4,...ã¨ããã¦ããæ°åãããã°ã²ããããä¸è¬é ãæ±ãããã¾ãã 33/4 ã 72/225 ã®ããã«å ¥åããã°æçæ°ãå¯è½ã§ãã 10^8ç¨åº¦ã®æ°å¤ã¾ã§ãªãæ£ãã精度ã§å¤åæ±ãã¾ãã ã½ã¼ã¹ã³ã¼ããDropboxã§å ¬éãã¦ããã¹ã¿ã¤ã«  åã®é ãããã   ------------------------------------------------- å¯ç£ç©ã¨ãã¦æçæ°ã®ç¯å²ã§éè¡åãæ±ããããããã°ã©ã ãã§ãã¾ããã 詳細ã表示  次å ã®è¡åã§ãã   ã»æºæ ã¡ã«ã»ã³ããã¤ã¹ã¿ã¨ãã§ã¯ããã¾ãããæªããããã ã¯ã¦ãªããã°ã£ã¦Javascript使ããã ããããªãã¦åæã«ãªã³ã¯ãå¼µã£ã¦ãããã®ãããã§ã ãã®è¨äºãæ¸ãã¦ããéä¸ã§ãããããã°é«æ ¡ã®æ°åã®å¤§é¨åã¯æ¼¸åå¼ã ã£ã ãããã®è¨äºã®å 容ããã¾ã使ããªãããåé¨çå¿æ´ã§ãã¦ãªããã¨ã«æ°ã¥ãã¾ããã ã¾ãã¾ãä»æ¹ãªãã§ãã Javascriptã触ã£ããã¨ããªãã£ãã®ã§ãã¨ã¦ãæãããã°ã©ã ã§ãã¿ã¾ãããã å ¨é¨ãæºæã¡ããã許ãã¦ããã¾ãã  â¦ã¨ãããã¨ã§KMCã¢ããã³ãã«ã¬ã³ãã¼9æ¥ç®ãåé¨çå¿æ´ï¼Javascriptã§ã²ãããè¡åï¼ã ã§ããã ææ¥ã®KMCã¢ããã³ãã«ã¬ã³ãã¼ã¯nojima(id:nojima718)ããã®ãC++ã®rvalueã®è©±ãã§ãï¼ ã¨ã¦ã楽ãã¿ã§ãï¼