追è¨ï¼ããããªè¨ã£ã¦ãã®æ£è¦è¡¨ç¾ã¯ãã¿ãªã®ã§ï¼å®éã«ç´ æ°å¤å®ãè¡ãããå ´åã¯ï¼ãã£ã¨å¥ãªè³¢ãã¢ã«ã´ãªãºã ã使ã£ãã»ããè¯ãã§ã æ£è¦è¡¨ç¾ã§ç´ æ°ãå¤å®ã§ããã¨ããè¨äºãè¦ãã®ã§è©¦ãã¦ã¿ãï¼ http://www.noulakaz.net/weblog/2007/03/18/a-regular-expression-to-check-for-prime-numbers/ ãã®è¨äºã«ãã㨠/^1?$|^(11+?)\1+$/ ã¨ããæ£è¦è¡¨ç¾ã使ãã¨ï¼ç´ æ°å¤å®ãåºæ¥ããããï¼ããæ´æ° n ãç´ æ°ãã©ããå¤å®ãããå ´åã¯ï¼"1" * nã¨ããæååããã®æ£è¦è¡¨ç¾ã«ããããããã©ããã調ã¹ãã°ããï¼ãããããã°éç´ æ°ï¼ãããããªããã°ç´ æ°ã¨ãªãï¼ãã ãï¼"1" * n ã¯ï¼ä¾ãã°ï¼n ã 4 ãªãã° "1111" 㨠1 ã 4 åé£ç¶ãã¦ç¶ãæååã¨ãªãï¼ Rubyã§æ¸ããç´ æ°å¤å®ããã°ã©ã ã¯ãã
{{#tags}}- {{label}}
{{/tags}}