åé¡ã¯ãã¡ããæ¯åãçãåããã«ä½¿ã£ã¦ããProject Euler: Python solutionsãããé«éã«ã§ããã æ¹éã¨ãã¦ã¯ 28123以ä¸ã®éå°æ°ã®ãªã¹ã abd ãæ±ããã 1.ã§ä½ã£ããªã¹ã abd ã使ãã1ãã28123ã¾ã§ã®å ¨ã¦ã®æ°ã«ã¤ãã¦2ã¤ã®éå°æ°ã®åã§æ¸ããã調ã¹ãã 2ã¤ã®éå°æ°ã§æ¸ããªãæ°ã®åãæ±ããã ã¾ãã¯ãçã®ç´æ°ã®ãªã¹ããè¿ãdivisorsãå®ç¾©ãï¼æ¬å½ã¯çã®ç´æ°ã®åãè¿ãã°ååã ãã©ãå¾ã 使ããããªã®ã§ï¼ def divisors(n): divs = [1] for i in xrange(2, int(math.sqrt(n)) + 1): if n % i == 0: divs.append(i) if n/i not in divs: divs.append(n/i) divs.sort() return divs ã¯ãããã¡ã¤ã³ã®å¦
{{#tags}}- {{label}}
{{/tags}}