## Project Euler个人解答(Problem 61~70)

2014年1月4日 发表评论 阅读评论

# Problem 61:Cyclical figurate numbers

Triangle, square, pentagonal, hexagonal, heptagonal, and octagonal numbers are all figurate (polygonal) numbers and are generated by the following formulae:

 Triangle P3,n=n(n+1)/2 1, 3, 6, 10, 15, ... Square P4,n=n2 1, 4, 9, 16, 25, ... Pentagonal P5,n=n(3n-1)/2 1, 5, 12, 22, 35, ... Hexagonal P6,n=n(2n-1) 1, 6, 15, 28, 45, ... Heptagonal P7,n=n(5n-3)/2 1, 7, 18, 34, 55, ... Octagonal P8,n=n(3n-2) 1, 8, 21, 40, 65, ...

The ordered set of three 4-digit numbers: 8128, 2882, 8281, has three interesting properties.

1. The set is cyclic, in that the last two digits of each number is the first two digits of the next number (including the last number with the first).
2. Each polygonal type: triangle (P3,127=8128), square (P4,91=8281), and pentagonal (P5,44=2882), is represented by a different number in the set.
3. This is the only set of 4-digit numbers with this property.

Find the sum of the only ordered set of six cyclic 4-digit numbers for which each polygonal type: triangle, square, pentagonal, hexagonal, heptagonal, and octagonal, is represented by a different number in the set.

 三角形数 P3,n=n(n+1)/2 1, 3, 6, 10, 15, ... 四角形数 P4,n=n2 1, 4, 9, 16, 25, ... 五角形数 P5,n=n(3n-1)/2 1, 5, 12, 22, 35, ... 六角形数 P6,n=n(2n-1) 1, 6, 15, 28, 45, ... 七角形数 P7,n=n(5n-3)/2 1, 7, 18, 34, 55, ... 八角形数 P8,n=n(3n-2) 1, 8, 21, 40, 65, ...

1. 这个集合是循环的：每个数的后两位数是下一个数的前两位数，包括第三个和第一个的关系。
2. 三种定形数中的每一种都能被这三个数中的一个不同的数代表：三角形数 (P3,127=8128), 四角形数 (P4,91=8281), 和五角形数 (P5,44=2882)。
3. 这是唯一具有以上性质的四位数的集合。

### Code：Python

def test(num,idx):
if   idx == 3:t = (sqrt(1+8*num)-1)/2
elif idx == 4:t = sqrt(num)
elif idx == 5:t = (sqrt(1+24*num)+1)/6
elif idx == 6:t = (sqrt(1+8*num)+1)/4
elif idx == 7:t = (sqrt(9+40*num)+3)/10
return t == int(t)

def figure(num,flag,idx):
flag[idx] = num;
if flag.count(0) == 0 and mod(num,100)==(flag[5]//100):
print flag,sum(flag)
return
for mowei in range(10,100):
nn = mod(num,100)*100+mowei
for i in range(7,2,-1):
if flag[i-3] == 0 and test(nn,i):
figure(nn,flag,i-3)
flag[i-3]=0

for i in range(21,22):
Octagonal = i*(3*i-2)
if mod(Octagonal,100) >= 10:
figure(Octagonal,[0,0,0,0,0,0],5)


# Problem 62:

The cube, 41063625 (3453), can be permuted to produce two other cubes: 56623104 (3843) and 66430125 (4053). In fact, 41063625 is the smallest cube which has exactly three permutations of its digits which are also cube.

Find the smallest cube for which exactly five permutations of its digits are cube.

### Code：Python

db =  {};
i = 1;
while True:
key = list(str(i**3))
key.sort()
key = ''.join(key)
if db.get( key ) == None:
db[key] = [1,i**3]
else:
db[key][0] += 1
if db[key][0] == 5:
print db[key][1]
break
i += 1


# Problem 63:Powerful digit counts

The 5-digit number, 16807=75, is also a fifth power. Similarly, the 9-digit number, 134217728=89, is a ninth power.

How many n-digit positive integers exist which are also an nth power?

$10^{n-1}\leq k=a^{n}<10^{n}$

10^$(\dfrac{n-1}{n})$≤a<10

### Code：Python

counter = 0
for n in range(1,22):
counter += 10-int(ceil(10**((n-1)/n)))
print counter


### Code：Mathematica

Total@Table[10 - Ceiling[10^((n - 1)/n)], {n, 1, 21}]


# Problem 64:Odd period square roots

【卧槽，这题目能再长再难敲一点？！英文有毛线人看啊！！】

All square roots are periodic when written as continued fractions and can be written in the form:

$\sqrt{N}=a_0+\dfrac{1}{a_1+\dfrac{1}{a_2+\dfrac{1}{a_3+...}}}$

For example, let us consider $\sqrt{23}$:

$\sqrt{23}=4+\sqrt{23}-4=4+\dfrac{1}{\dfrac{1}{\sqrt{23}-4}}=4+\dfrac{1}{1+\dfrac{\sqrt{23}-3}{7}}$

If we continue we would get the following expansion:

$\sqrt{23}=4+\dfrac{1}{1+\dfrac{1}{3+\dfrac{1}{1+\dfrac{1}{8+...}}}}$

The process can be summarised as follows:

$a_0=4,\dfrac{1}{\sqrt{23}-4}=\dfrac{\sqrt{23}+4}{7}=1+\dfrac{\sqrt{23}-3}{7}$

$a_1=1,\dfrac{7}{\sqrt{23}-3}=\dfrac{7(\sqrt{23}+3)}{14}=3+\dfrac{\sqrt{23}-3}{2}$

$a_2=3,\dfrac{2}{\sqrt{23}-3}=\dfrac{2(\sqrt{23}+3)}{14}=1+\dfrac{\sqrt{23}-4}{7}$

$a_3=1,\dfrac{7}{\sqrt{23}-4}=\dfrac{7(\sqrt{23}+4)}{7}=8+\sqrt{23}-4$

$a_4=8,\dfrac{1}{\sqrt{23}-4}=\dfrac{\sqrt{23}+4}{7}=1+\dfrac{\sqrt{23}-3}{7}$

$a_5=1,\dfrac{7}{\sqrt{23}-3}=\dfrac{7(\sqrt{23}+3)}{14}=3+\dfrac{\sqrt{23}-3}{2}$

$a_6=3,\dfrac{2}{\sqrt{23}-3}=\dfrac{2(\sqrt{23}+3)}{14}=1+\dfrac{\sqrt{23}-4}{7}$

$a_7=1,\dfrac{7}{\sqrt{23}-4}=\dfrac{7(\sqrt{23}+4)}{7}=8+\sqrt{23}-4$

It can be seen that the sequence is repeating. For conciseness, we use the notation $\sqrt{23}$ = [4;(1,3,1,8)], to indicate that the block (1,3,1,8) repeats indefinitely.

The first ten continued fraction representations of (irrational) square roots are:

$\sqrt{2}$=[1;(2)], period=1
$\sqrt{3}$=[1;(1,2)], period=2
$\sqrt{5}$=[2;(4)], period=1
$\sqrt{6}$=[2;(2,4)], period=2
$\sqrt{7}$=[2;(1,1,1,4)], period=4
$\sqrt{8}$=[2;(1,4)], period=2
$\sqrt{10}$=[3;(6)], period=1
$\sqrt{11}$=[3;(3,6)], period=2
$\sqrt{12}$= [3;(2,6)], period=2
$\sqrt{13}$=[3;(1,1,1,1,6)], period=5

Exactly four continued fractions, for N ≤ 13, have an odd period.

How many continued fractions for N ≤ 10000 have an odd period?

$\sqrt{N}=a_0+\dfrac{1}{a_1+\dfrac{1}{a_2+\dfrac{1}{a_3+...}}}$

$\sqrt{23}=4+\sqrt{23}-4=4+\dfrac{1}{\dfrac{1}{\sqrt{23}-4}}=4+\dfrac{1}{1+\dfrac{\sqrt{23}-3}{7}}$

$\sqrt{23}=4+\dfrac{1}{1+\dfrac{1}{3+\dfrac{1}{1+\dfrac{1}{8+...}}}}$

$a_0=4,\dfrac{1}{\sqrt{23}-4}=\dfrac{\sqrt{23}+4}{7}=1+\dfrac{\sqrt{23}-3}{7}$

$a_1=1,\dfrac{7}{\sqrt{23}-3}=\dfrac{7(\sqrt{23}+3)}{14}=3+\dfrac{\sqrt{23}-3}{2}$

$a_2=3,\dfrac{2}{\sqrt{23}-3}=\dfrac{2(\sqrt{23}+3)}{14}=1+\dfrac{\sqrt{23}-4}{7}$

$a_3=1,\dfrac{7}{\sqrt{23}-4}=\dfrac{7(\sqrt{23}+4)}{7}=8+\sqrt{23}-4$

$a_4=8,\dfrac{1}{\sqrt{23}-4}=\dfrac{\sqrt{23}+4}{7}=1+\dfrac{\sqrt{23}-3}{7}$

$a_5=1,\dfrac{7}{\sqrt{23}-3}=\dfrac{7(\sqrt{23}+3)}{14}=3+\dfrac{\sqrt{23}-3}{2}$

$a_6=3,\dfrac{2}{\sqrt{23}-3}=\dfrac{2(\sqrt{23}+3)}{14}=1+\dfrac{\sqrt{23}-4}{7}$

$a_7=1,\dfrac{7}{\sqrt{23}-4}=\dfrac{7(\sqrt{23}+4)}{7}=8+\sqrt{23}-4$

$\sqrt{2}$=[1;(2)], 周期=1
$\sqrt{3}$=[1;(1,2)], 周期=2
$\sqrt{5}$=[2;(4)], 周期=1
$\sqrt{6}$=[2;(2,4)], 周期=2
$\sqrt{7}$=[2;(1,1,1,4)], 周期=4
$\sqrt{8}$=[2;(1,4)], 周期=2
$\sqrt{10}$=[3;(6)], 周期=1
$\sqrt{11}$=[3;(3,6)], 周期=2
$\sqrt{12}$= [3;(2,6)], 周期=2
$\sqrt{13}$=[3;(1,1,1,1,6)], 周期=5

$\begin{eqnarray*}a_{n+1}+b_{n+1}\sqrt{S} & = &\dfrac{1}{a_{n}+b_{n}\sqrt{S}-k} \\& = & \dfrac{a_{n}-k-b_{n}\sqrt{S}}{(a_n-k)^2-b^2_nS}\\& = & \dfrac{a_{n}-k}{(a_n-k)^2-b^2_nS}+\dfrac{-b}{(a_n-k)^2-b^2_nS}\sqrt{S}\end{eqnarray*}$

$\left\{\begin{array}{ll}a_{n+1}=\dfrac{a_{n}-k}{(a_n-k)^2-b^2_nS}\\b_{n+1}=\dfrac{-b}{(a_n-k)^2-b^2_nS}\end{array}\right.$

$\begin{eqnarray*}\dfrac{\sqrt{S}+m_n}{d_n} & = &a_n+\dfrac{\sqrt{S}+m_n}{d_n}-a_n \\& = & a_n+\dfrac{\sqrt{S}+m_n-a_nd_n}{d_n}\\&=&a_n+\dfrac{1}{\dfrac{d_n}{\sqrt{S}+m_n-a_nd_n}}\end{eqnarray*}$

$\begin{eqnarray*}\dfrac{d_n}{\sqrt{S}+m_n-a_nd_n} & = &\dfrac{d_n(\sqrt{s}-m_n+a_nd_n)}{S-(m_n-a_nd_n)^2} \\& = & \dfrac{\sqrt{s}+(a_nd_n-m_n)}{\dfrac{S-(m_n-a_nd_n)^2}{d_n}}=\dfrac{\sqrt{S}+m_{n+1}}{d_{n+1}}\end{eqnarray*}$

$\left\{\begin{array}{ll}m_{n+1}=a_nd_n-m_n\\d_{n+1}=\dfrac{S-(m_n-a_nd_n)^2}{d_n}=\dfrac{S-m_{n+1}^2}{d_n}\end{array}\right.$

### Code：Python

#方法一：API
def GetLength(n):
if int(sqrt(n))==sqrt(n):
return 0
a = 0
b = 1
a0 = int(a+b*sqrt(n))
temp = []
while True:
k = int(a+b*sqrt(n))
if [k,round(a,4),round(b,4)] in temp:
idx = temp.index([k,round(a,4),round(b,4)])
return len(temp)-idx
temp.append([k,round(a,4),round(b,4)])
a,b = (a-k)/((a-k)**2-b**2*n),-b/((a-k)**2-b**2*n)


### Code：Python

#方法二：
def GetLength(S):
m = 0
d = 1
a0 = int(sqrt(S))
a = int(sqrt(S))
length = 0
while a != a0*2:
m = a*d-m
d = (S-m*m)/d
a = int((m+sqrt(S))/d)
length += 1
return length

counter = 0
for i in range(2,10000+1):
if int(sqrt(i)) != sqrt(i):
if mod(GetLength(i),2)==1:
counter += 1
print counter


# Problem 65:Convergents of e

【为毛这些题目都那么难敲！！】

The square root of 2 can be written as an infinite continued fraction.

$\sqrt{2}=1+\dfrac{1}{2+\dfrac{1}{2+\dfrac{1}{2+\dfrac{1}{2+...}}}}$

The infinite continued fraction can be written, √2 = [1;(2)], (2) indicates that 2 repeats ad infinitum. In a similar way, √23 = [4;(1,3,1,8)].

It turns out that the sequence of partial values of continued fractions for square roots provide the best rational approximations. Let us consider the convergents for √2.

$1+\dfrac{1}{2}=\dfrac{2}{3}$

$1+\dfrac{1}{2+\dfrac{1}{2}}=\dfrac{7}{5}$

$1+\dfrac{1}{2+\dfrac{1}{2+\dfrac{1}{2}}}=\dfrac{17}{12}$

$1+\dfrac{1}{2+\dfrac{1}{2+\dfrac{1}{2+\dfrac{1}{2}}}}=\dfrac{41}{29}$

Hence the sequence of the first ten convergents for √2 are:

1, 3/2, 7/5, 17/12, 41/29, 99/70, 239/169, 577/408, 1393/985, 3363/2378, ...
What is most surprising is that the important mathematical constant,
e = [2; 1,2,1, 1,4,1, 1,6,1 , ... , 1,2k,1, ...].

The first ten terms in the sequence of convergents for e are:

2, 3, 8/3, 11/4, 19/7, 87/32, 106/39, 193/71, 1264/465, 1457/536, ...

The sum of digits in the numerator of the 10th convergent is 1+4+5+7=17.

Find the sum of digits in the numerator of the 100th convergent of the continued fraction for e.

2的平方根可以写作无限连分数：

$\sqrt{2}=1+\dfrac{1}{2+\dfrac{1}{2+\dfrac{1}{2+\dfrac{1}{2+...}}}}$

$1+\dfrac{1}{2}=\dfrac{2}{3}$

$1+\dfrac{1}{2+\dfrac{1}{2}}=\dfrac{7}{5}$

$1+\dfrac{1}{2+\dfrac{1}{2+\dfrac{1}{2}}}=\dfrac{17}{12}$

$1+\dfrac{1}{2+\dfrac{1}{2+\dfrac{1}{2+\dfrac{1}{2}}}}=\dfrac{41}{29}$

1, 3/2, 7/5, 17/12, 41/29, 99/70, 239/169, 577/408, 1393/985, 3363/2378, ...

e = [2; 1,2,1, 1,4,1, 1,6,1 , ... , 1,2k,1, ...].

e 的收敛项序列中的前十项是：

2, 3, 8/3, 11/4, 19/7, 87/32, 106/39, 193/71, 1264/465, 1457/536, ...

### Code：Python

def getxunhuanjie(n):
result = []
k = 2
while len(result) < n:
result += [1,k,1]
k += 2
return result[0:n]

result = getxunhuanjie(99)
a,b = 1,result[-1]
for i in range(len(result)-2,-1,-1):
a,b=b,a+b*result[i]

print sum(map(int,list(str(a+2*b))))


# Problem 66:Diophantine equation

Consider quadratic Diophantine equations of the form:

x2 – Dy2 = 1

For example, when D=13, the minimal solution in x is 6492 – 13×1802 = 1.

It can be assumed that there are no solutions in positive integers when D is square.

By finding minimal solutions in x for D = {2, 3, 5, 6, 7}, we obtain the following:

32 – 2×22 = 1
22 – 3×12 = 1
92 – 5×42 = 1
52 – 6×22 = 1
82 – 7×32 = 1

Hence, by considering minimal solutions in x for D ≤ 7, the largest x is obtained when D=5.

Find the value of D ≤ 1000 in minimal solutions of x for which the largest value of x is obtained.

x2 – Dy2 = 1

32 – 2×22 = 1
22 – 3×12 = 1
92 – 5×42 = 1
52 – 6×22 = 1
82 – 7×32 = 1

### Code：Python

#获取连分数循环节
def GetXHJ(S):
m,d = 0,1
a = a0 = int(sqrt(S))
result = [a0]
while a != a0*2:
m = a*d-m
d = (S-m*m)/d
a = int((m+sqrt(S))/d)
result += [a]
return result

#生成器，不断返回渐进的连分数
def GetJianjin(LFS):
idx = 1
result = [LFS[0]]
while True:
a,b = 1,result[idx-1]
for i in range(idx-2,-1,-1):
a,b=b,a+b*result[i]
yield [a,b]
idx += 1
result += [LFS[mod(idx-2,len(LFS)-1)+1]]

def GetMinx(D):
for k in GetJianjin(GetXHJ(D)):
if k[1]*k[1]-D*k[0]*k[0] == 1:
return k[1]

#main
maxp = -1
maxD = 1
for D in range(5,1001):
if sqrt(D)==int(sqrt(D)):
continue
t = GetMinx(D)
if t > maxp:
maxp = t
maxD = D
print maxD


# Problem 67:

By starting at the top of the triangle below and moving to adjacent numbers on the row below, the maximum total from top to bottom is 23.

3
7 4
2 4 6
8 5 9 3

That is, 3 + 7 + 4 + 9 = 23.

Find the maximum total from top to bottom in triangle.txt (right click and 'Save Link/Target As...'), a 15K text file containing a triangle with one-hundred rows.

NOTE: This is a much more difficult version of Problem 18. It is not possible to try every route to solve this problem, as there are 299 altogether! If you could check one trillion (1012) routes every second it would take over twenty billion years to check them all. There is an efficient algorithm to solve it. ;o)

3
7 4
2 4 6
8 5 9 3

That is, 3 + 7 + 4 + 9 = 23.

triangle.txt(右键另存为)是一个文本文件，包含了一个一百行的三角形，找出这个三角形中从顶到底的最大和。

### Code：Mathematica

tri = {读入数据};
tri2 = StringSplit[tri, "\n"][[1]];
tri3 = ToExpression[StringSplit[#, " "] & /@ tri2];
For[i = Length[tri3] - 1, i >= 1, i -= 1,
For[j = 1, j < = Length[tri3[[i]]], j += 1,
tri3[[i]][[j]] += Max[{tri3[[i + 1]][[j]], tri3[[i + 1]][[j + 1]]  }]]];
tri3 // Column


# Problem 68:Magic 5-gon ring

Consider the following "magic" 3-gon ring, filled with the numbers 1 to 6, and each line adding to nine.

Working clockwise, and starting from the group of three with the numerically lowest external node (4,3,2 in this example), each solution can be described uniquely. For example, the above solution can be described by the set: 4,3,2; 6,2,1; 5,1,3.

It is possible to complete the ring with four different totals: 9, 10, 11, and 12. There are eight solutions in total.

 Total Solution Set 9 4,2,3; 5,3,1; 6,1,2 9 4,3,2; 6,2,1; 5,1,3 10 2,3,5; 4,5,1; 6,1,3 10 2,5,3; 6,3,1; 4,1,5 11 1,4,6; 3,6,2; 5,2,4 11 1,6,4; 5,4,2; 3,2,6 12 1,5,6; 2,6,4; 3,4,5 12 1,6,5; 3,5,4; 2,4,6

By concatenating each group it is possible to form 9-digit strings; the maximum string for a 3-gon ring is 432621513.

Using the numbers 1 to 10, and depending on arrangements, it is possible to form 16- and 17-digit strings. What is the maximum 16-digit string for a "magic" 5-gon ring?

 和 解 9 4,2,3; 5,3,1; 6,1,2 9 4,3,2; 6,2,1; 5,1,3 10 2,3,5; 4,5,1; 6,1,3 10 2,5,3; 6,3,1; 4,1,5 11 1,4,6; 3,6,2; 5,2,4 11 1,6,4; 5,4,2; 3,2,6 12 1,5,6; 2,6,4; 3,4,5 12 1,6,5; 3,5,4; 2,4,6

### Code：Python

def QPL(m_list):
if len(m_list) == 1:
yield m_list
for i in range(len(m_list)):
if len(m_list) == 10 and m_list[i] > 6:
continue
restlist = m_list[0:i]+m_list[i+1:]
for subres in QPL(restlist):
yield [m_list[i]]+subres;

for k in QPL([9,8,7,6,5,4,3,2,1,10]):
#k[0]是外圈最小
if k[0]>k[3] or k[0]>k[5] or k[0]>k[7] or k[0]>k[9]:
continue

sum = k[0]+k[1]+k[2]
if sum == k[3]+k[2]+k[4] and\
sum == k[5]+k[4]+k[6] and\
sum == k[7]+k[6]+k[8] and \
sum == k[9]+k[8]+k[1]:
print ''.join(map(str,[k[0],k[1],k[2],\
k[3],k[2],k[4],\
k[5],k[4],k[6],\
k[7],k[6],k[8],\
k[9],k[8],k[1]]))
break


# Problem 69:Totient maximum

Euler's Totient function, φ(n) [sometimes called the phi function], is used to determine the number of numbers less than n which are relatively prime to n. For example, as 1, 2, 4, 5, 7, and 8, are all less than nine and relatively prime to nine, φ(9)=6.

 n Relatively Prime φ(n) n/φ(n) 2 1 1 2 3 1,2 2 1.5 4 1,3 2 2 5 1,2,3,4 4 1.25 6 1,5 2 3 7 1,2,3,4,5,6 6 1.1666... 8 1,3,5,7 4 2 9 1,2,4,5,7,8 6 1.5 10 1,3,7,9 4 2.5

It can be seen that n=6 produces a maximum n/φ(n) for n ≤ 10.

Find the value of n ≤ 1,000,000 for which n/φ(n) is a maximum.

 n 互质数 φ(n) n/φ(n) 2 1 1 2 3 1,2 2 1.5 4 1,3 2 2 5 1,2,3,4 4 1.25 6 1,5 2 3 7 1,2,3,4,5,6 6 1.1666... 8 1,3,5,7 4 2 9 1,2,4,5,7,8 6 1.5 10 1,3,7,9 4 2.5

$\phi (n)=n\prod\limits_{p|n}(1-\dfrac{1}{p})$

$\dfrac{n}{\phi (n)}=\prod\limits_{p|n}\dfrac{p}{p-1}$

### Code：Mathematica

fai[n_] := n*Times @@ ((1 - 1/#) & /@ First /@ FactorInteger[n])
SortBy[ParallelTable[{n, n/fai[n]}, {n, 2, 1000000}], Last]//Last


# Problem 70:Totient permutation

Euler's Totient function, φ(n) [sometimes called the phi function], is used to determine the number of positive numbers less than or equal to n which are relatively prime to n. For example, as 1, 2, 4, 5, 7, and 8, are all less than nine and relatively prime to nine, φ(9)=6.

The number 1 is considered to be relatively prime to every positive number, so φ(1)=1.

Interestingly, φ(87109)=79180, and it can be seen that 87109 is a permutation of 79180.

Find the value of n, 1 < n < 107 , for which φ(n) is a permutation of n and the ratio n/φ(n) produces a minimum.

$\begin{eqnarray*}\phi (n) & = &n(1-\dfrac{1}{p})(1-\dfrac{1}{q}) \\& = & pq(1-\dfrac{1}{p})(1-\dfrac{1}{q})\\& = & (p-1)(q-1)\end{eqnarray*}$

### Code：Python

#判断乘积是不是符合条件
def test(i,j):
k1 = sorted(list(str((i-1)*(j-1))))
k2 = sorted(list(str(i*j)))
return k1 == k2

#筛选质数
T = 10000000
primelist = [1]*T
primelist[0]=primelist[1]=0
for i in range(2,T):
if primelist[i] != 1:
continue
for j in range(i*2,T,i):
primelist[j] = 0

idx = -1
minn = 9999999
for i in xrange(3,T,2):
if i > 3162:
break
if primelist[i] != 1:
continue
for j in range(i+2,int(T/i),2):
if primelist[j] != 1:
continue
if test(i,j):
if i*j/(i-1)/(j-1) < minn:
minn = i*j/(i-1)/(j-1)
idx = i*j
print idx


【完】

1. 2014年1月4日13:25 | #1

额，好吧，完全看不懂，好像很牛逼！

• 2014年1月4日14:22 | #2

其实好像除了代码，数学部分应该是初中水平的。。。不过现在好像做网站的人对数学都兴趣不大。。

2. 2014年1月4日18:05 | #3

你这更新的速度略快啊，少年我看的速度完全跟不上这个节奏

• 2014年1月4日18:31 | #4

你个渣渣。。。不过接下来就不弄了。。。至少论文搞完才会弄。。

• 2014年1月4日18:56 | #5

我期待着传说中的剁手

• 2014年1月4日18:57 | #6

我都立下此誓了，就是铁了心好好水论文的节奏。。虽然要先把北京那破事给搞定。。

• 2014年1月4日18:59 | #7

我那边也要快点水一篇才行啊，要不然年不好过啊

• 2014年1月4日19:01 | #8

你可是说了春节前交初稿的。。。虽然我是交终稿。。

• 2014年1月4日19:03 | #9

我是为自己留个后路啊，要不然回不了家怎么办

3. 2014年1月5日20:29 | #10

好赞，不过为啥用python写呢。一直只刷过poj和hdu的题目(自己渣学校的不说也罢)

• 2014年1月5日20:38 | #11

因为python简单。。。只要算法不是太糟糕，我一般就Mma或者Python解决，反正运行时间控制在几秒内，而且python写起来快，可读性上感觉也比较好（我是来分享算法思想的，对于代码怎么写其实不是很要紧。。如果算法设计不出来，python这一类语言太慢的话，我就马上转战C++，因为那个是本命。。

• 2014年1月5日22:56 | #12

你们都说python好看，果然我审美观奇葩么。。。我最喜欢看的是C/C++了，看它写的算法思路特别明晰，如果哪天我居然写python的东西了，一定是迁就哪个讨厌的同僚

• 2014年1月5日23:14 | #13

真爱是C++，但是这种题如果每道题都用C++的话，需要写的代码会很长一般统计表示实现相同的功能Py的长度是C的五分之一。Python也没那么差吧。。

• 2014年1月5日23:17 | #14

糟糕的印象来源于这个: https://github.com/DionyBudy/svd_with_parse/blob/master/svd.c 这是我直译的C代码，原文python忘了在哪了...没有任何的优化，就语言本身把运行时间减少了数十乃至上百倍。

• 2014年1月5日23:18 | #15

十万条数据貌似，python原文同学跑了快一小时，然后让我翻译下来试试看，20秒搞定。这不是扯淡么 -- 从此我只把这东西当成演示用语言。。

• 2014年1月5日23:23 | #16

速度慢确实就是python的一个致命问题和C比，据我印象好像相同的算法速度差也是100倍左右，所以我不会用python去做高速计算的问题，也没人会这么做；而做ACM这种题，如果python能秒出，那么说明C必然秒出，而ACM的精华本身也在于算法的设计，而不是怎么编程实现；

• 2014年1月5日23:24 | #17

不过有时算法有了也会必须用C++，因为指针这种神器可以做更加复杂的数据结构，而数据结构越复杂，就可以让算法越简单~

• 2014年1月5日20:46 | #18

我一般是在PE上还有lightoj上玩。。反正选定一个一直玩就是了，OJ平台这么多，根本玩不完。。。

• 2014年1月5日22:58 | #19

以前老一輩的学长传下来过一堆资料，其中包括不错的ACM OJ列表， 我很多都上去玩过 -- 话说几年下来，好多网站已经关门或者改域名了，真是物是人非啊 http://argcv.com/articles/49.c

4. 2014年1月6日02:22 | #20

真正不明觉厉，点32个赞先~~~

5. 2014年1月6日12:59 | #21

传说中的学霸？

• 2014年1月6日14:13 | #22

当然不是。。。除去代码都是初中生就能看得懂的题目。。

6. 2014年1月6日14:52 | #23

不明觉厉　　　 ╯　　　 　╰ 　　　 ●　　　 　 ● 　　　 " 　 　^　 　 "

7. 2014年1月6日20:24 | #24

真不好意思，让你记住我了

• 2014年1月6日20:27 | #25

啥？没懂。。

• 2014年1月6日20:27 | #26

你猜

• 2014年1月6日20:31 | #27

虽然没懂，但是我记得的是这是你第二次在我博客回我“你猜”了。。。【别这样亲。。

• 2014年1月6日20:33 | #28

你记性真不错，我自己都忘了

• 2014年1月6日20:35 | #29

所以我还是没懂你一开始那句意义不明的话。。。

• 2014年1月6日20:37 | #30

不需要明白，没有意义

8. 2014年1月6日22:48 | #31

高级，看不懂。

9. 2014年1月7日15:11 | #32

专业性很强啊，我表示没看完。

• 2014年1月7日15:40 | #33

其实我也没指望有人看完，就是个人笔记性质

10. 2014年1月7日15:17 | #34

貌似很牛逼的样子

• 2014年1月7日15:41 | #35

其实不是。。连微积分都没用上，就是初中数学。。

11. 2014年1月9日22:09 | #37

好专业的博客看不懂

12. 2014年1月10日09:46 | #38

学霸啊

13. 2014年7月15日22:03 | #39

佩服！以后想写跟数论问题有关的代码可以请教你吗？好佩服你！！！

• 2014年7月15日23:03 | #40

谢谢；可以的；但我不是专业的。。

• 2014年7月17日10:54 | #41

感觉你比很多专业的研究得深入很多！

• 2014年7月17日10:57 | #42

错觉错觉。。。我就是来搞笑一下的~

14. 2015年10月1日16:43 | #43

好久没来了，过来转转