Skip to content
created by Aha00aAha00a at 2016-12-20
last modified by Aha00aAha00a at 2016-12-23
revision: 2

ProjectEuler Problem29

http://projecteuler.net/index.php?section=problems&id=29

Distinct powers

2 ≤ a ≤ 5, 2 ≤ b ≤ 5에 대해 a^b의 모든 가능한 조합은 다음과 같다.

2^2=4, 2^3=8, 2^4=16, 2^5=32

3^2=9, 3^3=27, 3^4=81, 3^5=243

4^2=16, 4^3=64, 4^4=256, 4^5=1024

5^2=25, 5^3=125, 5^4=625, 5^5=3125

중복을 제거하고 정렬하면 15개의 구분되는 항을 갖는 수열이 나온다.

4, 8, 9, 16, 25, 27, 32, 64, 81, 125, 243, 256, 625, 1024, 3125

2 ≤ a ≤ 100, 2 ≤ b ≤ 100에 대해 a^b의 모든 가능한 조합의 중복제거된 항의 수는?

1. Solution

9183

별거 없다. 걍 풀면 됨.

(for (a <- 2 to 100; b <- 2 to 100) yield Math.pow(a, b)).distinct.length

65ms 걸린다. --2016-12-20

2. See Also

2.2. Adjacent Pages

Control
≤ 32
all
1.0x
1.0x
80
-120
ON
Metrics
Nodes(visible/total)0/0
Links(visible/total)0/0
Avg degree0.00
Depth coverage0
Queue(fetch/graph)0 / 0
Zoom(scale)1.00x
Ctrl/⌘ + Scroll: Zoom
Root 1-hop 2-hop+