Chinaunix首页 | 论坛 | 博客
  • 博客访问: 86578
  • 博文数量: 47
  • 博客积分: 1410
  • 博客等级: 上尉
  • 技术积分: 625
  • 用 户 组: 普通用户
  • 注册时间: 2008-11-11 12:11
文章分类

全部博文(47)

文章存档

2008年(47)

我的朋友

分类:

2008-11-23 17:43:21

Problem 56

07 November 2003

A googol (10100) is a massive number: one followed by one-hundred zeros; 100100 is almost unimaginably large: one followed by two-hundred zeros. Despite their size, the sum of the digits in each number is only 1.

Considering natural numbers of the form, ab, where a, b 100, what is the maximum digital sum?

def fun56():
    result = [0,0,0]
    for i in range(2, 100):
        for j in range(1,100):
            t = i**j
            t = reduce(add, map(int, str(t)))
            if t > result[0]:
                result = [t,i,j]
    return result

answer is 972, 99**95
time:1.125
阅读(483) | 评论(0) | 转发(0) |
0

上一篇:Problem 53

下一篇:Problem 58

给主人留下些什么吧!~~