forked from manwar/perlweeklychallenge-club
-
Notifications
You must be signed in to change notification settings - Fork 1
/
ch-2.r
51 lines (46 loc) · 1.49 KB
/
ch-2.r
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
#!/usr/local/bin/Rscript
#
# See https://theweeklychallenge.org/blog/perl-weekly-challenge-149
#
#
# Run as: Rscript ch-2.r < input-file
#
A287298 <- c ()
max_base <- 25
A287298 [[ 2]] <- "1"
A287298 [[ 3]] <- "1"
A287298 [[ 4]] <- "3201"
A287298 [[ 5]] <- "4301"
A287298 [[ 6]] <- "452013"
A287298 [[ 7]] <- "6250341"
A287298 [[ 8]] <- "47302651"
A287298 [[ 9]] <- "823146570"
A287298 [[10]] <- "9814072356"
A287298 [[11]] <- "A8701245369"
A287298 [[12]] <- "B8750A649321"
A287298 [[13]] <- "CBA504216873"
A287298 [[14]] <- "DC71B30685A924"
A287298 [[15]] <- "EDAC93B24658701"
A287298 [[16]] <- "FED5B39A42706C81"
A287298 [[17]] <- "GFED5A31C6B79802"
A287298 [[18]] <- "HGF80ADC53712EB649"
A287298 [[19]] <- "IHGFD3408C6E715A2B9"
A287298 [[20]] <- "JIHG03DAC457BFE96281"
A287298 [[22]] <- "LKJIG5D14B9032FHAC867E"
A287298 [[23]] <- "MLKJEFG5IC1D9H8042AB376"
A287298 [[24]] <- "NMLKJ2BD0639GFE7C8IH5A41"
A287298 [[25]] <- "ONMLKD8CJE2H47F6395I0B1AG"
stdin <- file ('stdin', 'r')
repeat {
n <- readLines (stdin, n = 1)
if (length (n) == 0) {
break
}
n = as.integer (n)
if (n > max_base || is.null (A287298 [[n]])) {
cat ("Too hard to calculate\n")
}
else {
cat (A287298 [[n]], "\n")
}
}