List all possible titles for the *Anno* games
Clash Royale CLAN TAG#URR8PPP
up vote
2
down vote
favorite
In the Anno video game series there are 6 games with a 7th one announced for early 2019. Their titles always feature a year in a specific pattern:
Anno 1602, Anno 1503, Anno 1701, Anno 1404, Anno 2070, Anno 2205, Anno 1800
- The digital sum is always 9.
- The years are four digits long.
- They contain at least one zero.
Within these constrains there exist 109 possible titles:
[1008,1017,1026,1035,1044,1053,1062,1071,1080,1107,1170,1206,1260,1305,1350,1404,1440,1503,1530,1602,1620,1701,1710,1800,2007,2016,2025,2034,2043,2052,2061,2070,2106,2160,2205,2250,2304,2340,2403,2430,2502,2520,2601,2610,2700,3006,3015,3024,3033,3042,3051,3060,3105,3150,3204,3240,3303,3330,3402,3420,3501,3510,3600,4005,4014,4023,4032,4041,4050,4104,4140,4203,4230,4302,4320,4401,4410,4500,5004,5013,5022,5031,5040,5103,5130,5202,5220,5301,5310,5400,6003,6012,6021,6030,6102,6120,6201,6210,6300,7002,7011,7020,7101,7110,7200,8001,8010,8100,9000]
Your objective is to list them all in any reasonable form in the fewest number of bytes.
code-golf number kolmogorov-complexity
add a comment |Â
up vote
2
down vote
favorite
In the Anno video game series there are 6 games with a 7th one announced for early 2019. Their titles always feature a year in a specific pattern:
Anno 1602, Anno 1503, Anno 1701, Anno 1404, Anno 2070, Anno 2205, Anno 1800
- The digital sum is always 9.
- The years are four digits long.
- They contain at least one zero.
Within these constrains there exist 109 possible titles:
[1008,1017,1026,1035,1044,1053,1062,1071,1080,1107,1170,1206,1260,1305,1350,1404,1440,1503,1530,1602,1620,1701,1710,1800,2007,2016,2025,2034,2043,2052,2061,2070,2106,2160,2205,2250,2304,2340,2403,2430,2502,2520,2601,2610,2700,3006,3015,3024,3033,3042,3051,3060,3105,3150,3204,3240,3303,3330,3402,3420,3501,3510,3600,4005,4014,4023,4032,4041,4050,4104,4140,4203,4230,4302,4320,4401,4410,4500,5004,5013,5022,5031,5040,5103,5130,5202,5220,5301,5310,5400,6003,6012,6021,6030,6102,6120,6201,6210,6300,7002,7011,7020,7101,7110,7200,8001,8010,8100,9000]
Your objective is to list them all in any reasonable form in the fewest number of bytes.
code-golf number kolmogorov-complexity
add a comment |Â
up vote
2
down vote
favorite
up vote
2
down vote
favorite
In the Anno video game series there are 6 games with a 7th one announced for early 2019. Their titles always feature a year in a specific pattern:
Anno 1602, Anno 1503, Anno 1701, Anno 1404, Anno 2070, Anno 2205, Anno 1800
- The digital sum is always 9.
- The years are four digits long.
- They contain at least one zero.
Within these constrains there exist 109 possible titles:
[1008,1017,1026,1035,1044,1053,1062,1071,1080,1107,1170,1206,1260,1305,1350,1404,1440,1503,1530,1602,1620,1701,1710,1800,2007,2016,2025,2034,2043,2052,2061,2070,2106,2160,2205,2250,2304,2340,2403,2430,2502,2520,2601,2610,2700,3006,3015,3024,3033,3042,3051,3060,3105,3150,3204,3240,3303,3330,3402,3420,3501,3510,3600,4005,4014,4023,4032,4041,4050,4104,4140,4203,4230,4302,4320,4401,4410,4500,5004,5013,5022,5031,5040,5103,5130,5202,5220,5301,5310,5400,6003,6012,6021,6030,6102,6120,6201,6210,6300,7002,7011,7020,7101,7110,7200,8001,8010,8100,9000]
Your objective is to list them all in any reasonable form in the fewest number of bytes.
code-golf number kolmogorov-complexity
In the Anno video game series there are 6 games with a 7th one announced for early 2019. Their titles always feature a year in a specific pattern:
Anno 1602, Anno 1503, Anno 1701, Anno 1404, Anno 2070, Anno 2205, Anno 1800
- The digital sum is always 9.
- The years are four digits long.
- They contain at least one zero.
Within these constrains there exist 109 possible titles:
[1008,1017,1026,1035,1044,1053,1062,1071,1080,1107,1170,1206,1260,1305,1350,1404,1440,1503,1530,1602,1620,1701,1710,1800,2007,2016,2025,2034,2043,2052,2061,2070,2106,2160,2205,2250,2304,2340,2403,2430,2502,2520,2601,2610,2700,3006,3015,3024,3033,3042,3051,3060,3105,3150,3204,3240,3303,3330,3402,3420,3501,3510,3600,4005,4014,4023,4032,4041,4050,4104,4140,4203,4230,4302,4320,4401,4410,4500,5004,5013,5022,5031,5040,5103,5130,5202,5220,5301,5310,5400,6003,6012,6021,6030,6102,6120,6201,6210,6300,7002,7011,7020,7101,7110,7200,8001,8010,8100,9000]
Your objective is to list them all in any reasonable form in the fewest number of bytes.
code-golf number kolmogorov-complexity
code-golf number kolmogorov-complexity
asked 34 mins ago


Laikoni
18.8k33391
18.8k33391
add a comment |Â
add a comment |Â
4 Answers
4
active
oldest
votes
up vote
2
down vote
Python 2, 67 bytes
print[y for y in range(1000,9001)if('0'in`y`)*sum(map(int,`y`))==9]
Try it online!
Alternatives (also 67):
print[y for y in range(9001)if('0'in`y`)*sum(map(int,`y`))==9][18:]
print[y for y in range(9001)if('0'in`y`)*sum(map(int,`y`))==9<y/99]
range(1000
=>range(999
saves one byte
– Luis felipe De jesus Munoz
2 mins ago
add a comment |Â
up vote
1
down vote
R, 82 bytes
write((x=t(expand.grid(1:9,0:9,0:9,0:9)))[,colSums(x)==9&!apply(x,2,all)],1,4,,"")
Try it online!
Generates a matrix x
of all possible 4-digit numbers, excluding leading zeros, going down columns. Then filters for column (digital) sums of 9 and containing zero, i.e., not all
are nonzero. write
prints down the columns, so we write
to stdout
with a width of 4
and a separator of ""
.
Nice answer! I came up with a different route...
– J.Doe
6 mins ago
add a comment |Â
up vote
1
down vote
R, 60 bytes
Outputs the valid numbers as the names of a vector of 9's.
x=colSums(sapply(grep(0,999:9999,,,T),utf8ToInt)-48);x[x==9]
Try it online!
1
ah,grep
, why do I never remember that it casts tocharacter
...
– Giuseppe
46 secs ago
add a comment |Â
up vote
0
down vote
Japt, 20 bytes
A³ò#〈 ms f_¬x ¥9©Zø0
A³ò#〈 ms f_¬x ¥9©Zø0 Full program
A³ò#〈 Range from [1000 9001)
ms Convert to string
f_ Filter values that
¬x ¥9 Sum equal to 9
©Zø0 And contains at least one 0
Try it online!
add a comment |Â
4 Answers
4
active
oldest
votes
4 Answers
4
active
oldest
votes
active
oldest
votes
active
oldest
votes
up vote
2
down vote
Python 2, 67 bytes
print[y for y in range(1000,9001)if('0'in`y`)*sum(map(int,`y`))==9]
Try it online!
Alternatives (also 67):
print[y for y in range(9001)if('0'in`y`)*sum(map(int,`y`))==9][18:]
print[y for y in range(9001)if('0'in`y`)*sum(map(int,`y`))==9<y/99]
range(1000
=>range(999
saves one byte
– Luis felipe De jesus Munoz
2 mins ago
add a comment |Â
up vote
2
down vote
Python 2, 67 bytes
print[y for y in range(1000,9001)if('0'in`y`)*sum(map(int,`y`))==9]
Try it online!
Alternatives (also 67):
print[y for y in range(9001)if('0'in`y`)*sum(map(int,`y`))==9][18:]
print[y for y in range(9001)if('0'in`y`)*sum(map(int,`y`))==9<y/99]
range(1000
=>range(999
saves one byte
– Luis felipe De jesus Munoz
2 mins ago
add a comment |Â
up vote
2
down vote
up vote
2
down vote
Python 2, 67 bytes
print[y for y in range(1000,9001)if('0'in`y`)*sum(map(int,`y`))==9]
Try it online!
Alternatives (also 67):
print[y for y in range(9001)if('0'in`y`)*sum(map(int,`y`))==9][18:]
print[y for y in range(9001)if('0'in`y`)*sum(map(int,`y`))==9<y/99]
Python 2, 67 bytes
print[y for y in range(1000,9001)if('0'in`y`)*sum(map(int,`y`))==9]
Try it online!
Alternatives (also 67):
print[y for y in range(9001)if('0'in`y`)*sum(map(int,`y`))==9][18:]
print[y for y in range(9001)if('0'in`y`)*sum(map(int,`y`))==9<y/99]
edited 11 mins ago
answered 26 mins ago


TFeld
12.5k2835
12.5k2835
range(1000
=>range(999
saves one byte
– Luis felipe De jesus Munoz
2 mins ago
add a comment |Â
range(1000
=>range(999
saves one byte
– Luis felipe De jesus Munoz
2 mins ago
range(1000
=> range(999
saves one byte– Luis felipe De jesus Munoz
2 mins ago
range(1000
=> range(999
saves one byte– Luis felipe De jesus Munoz
2 mins ago
add a comment |Â
up vote
1
down vote
R, 82 bytes
write((x=t(expand.grid(1:9,0:9,0:9,0:9)))[,colSums(x)==9&!apply(x,2,all)],1,4,,"")
Try it online!
Generates a matrix x
of all possible 4-digit numbers, excluding leading zeros, going down columns. Then filters for column (digital) sums of 9 and containing zero, i.e., not all
are nonzero. write
prints down the columns, so we write
to stdout
with a width of 4
and a separator of ""
.
Nice answer! I came up with a different route...
– J.Doe
6 mins ago
add a comment |Â
up vote
1
down vote
R, 82 bytes
write((x=t(expand.grid(1:9,0:9,0:9,0:9)))[,colSums(x)==9&!apply(x,2,all)],1,4,,"")
Try it online!
Generates a matrix x
of all possible 4-digit numbers, excluding leading zeros, going down columns. Then filters for column (digital) sums of 9 and containing zero, i.e., not all
are nonzero. write
prints down the columns, so we write
to stdout
with a width of 4
and a separator of ""
.
Nice answer! I came up with a different route...
– J.Doe
6 mins ago
add a comment |Â
up vote
1
down vote
up vote
1
down vote
R, 82 bytes
write((x=t(expand.grid(1:9,0:9,0:9,0:9)))[,colSums(x)==9&!apply(x,2,all)],1,4,,"")
Try it online!
Generates a matrix x
of all possible 4-digit numbers, excluding leading zeros, going down columns. Then filters for column (digital) sums of 9 and containing zero, i.e., not all
are nonzero. write
prints down the columns, so we write
to stdout
with a width of 4
and a separator of ""
.
R, 82 bytes
write((x=t(expand.grid(1:9,0:9,0:9,0:9)))[,colSums(x)==9&!apply(x,2,all)],1,4,,"")
Try it online!
Generates a matrix x
of all possible 4-digit numbers, excluding leading zeros, going down columns. Then filters for column (digital) sums of 9 and containing zero, i.e., not all
are nonzero. write
prints down the columns, so we write
to stdout
with a width of 4
and a separator of ""
.
answered 22 mins ago
Giuseppe
15.4k31051
15.4k31051
Nice answer! I came up with a different route...
– J.Doe
6 mins ago
add a comment |Â
Nice answer! I came up with a different route...
– J.Doe
6 mins ago
Nice answer! I came up with a different route...
– J.Doe
6 mins ago
Nice answer! I came up with a different route...
– J.Doe
6 mins ago
add a comment |Â
up vote
1
down vote
R, 60 bytes
Outputs the valid numbers as the names of a vector of 9's.
x=colSums(sapply(grep(0,999:9999,,,T),utf8ToInt)-48);x[x==9]
Try it online!
1
ah,grep
, why do I never remember that it casts tocharacter
...
– Giuseppe
46 secs ago
add a comment |Â
up vote
1
down vote
R, 60 bytes
Outputs the valid numbers as the names of a vector of 9's.
x=colSums(sapply(grep(0,999:9999,,,T),utf8ToInt)-48);x[x==9]
Try it online!
1
ah,grep
, why do I never remember that it casts tocharacter
...
– Giuseppe
46 secs ago
add a comment |Â
up vote
1
down vote
up vote
1
down vote
R, 60 bytes
Outputs the valid numbers as the names of a vector of 9's.
x=colSums(sapply(grep(0,999:9999,,,T),utf8ToInt)-48);x[x==9]
Try it online!
R, 60 bytes
Outputs the valid numbers as the names of a vector of 9's.
x=colSums(sapply(grep(0,999:9999,,,T),utf8ToInt)-48);x[x==9]
Try it online!
answered 7 mins ago
J.Doe
1,471111
1,471111
1
ah,grep
, why do I never remember that it casts tocharacter
...
– Giuseppe
46 secs ago
add a comment |Â
1
ah,grep
, why do I never remember that it casts tocharacter
...
– Giuseppe
46 secs ago
1
1
ah,
grep
, why do I never remember that it casts to character
...– Giuseppe
46 secs ago
ah,
grep
, why do I never remember that it casts to character
...– Giuseppe
46 secs ago
add a comment |Â
up vote
0
down vote
Japt, 20 bytes
A³ò#〈 ms f_¬x ¥9©Zø0
A³ò#〈 ms f_¬x ¥9©Zø0 Full program
A³ò#〈 Range from [1000 9001)
ms Convert to string
f_ Filter values that
¬x ¥9 Sum equal to 9
©Zø0 And contains at least one 0
Try it online!
add a comment |Â
up vote
0
down vote
Japt, 20 bytes
A³ò#〈 ms f_¬x ¥9©Zø0
A³ò#〈 ms f_¬x ¥9©Zø0 Full program
A³ò#〈 Range from [1000 9001)
ms Convert to string
f_ Filter values that
¬x ¥9 Sum equal to 9
©Zø0 And contains at least one 0
Try it online!
add a comment |Â
up vote
0
down vote
up vote
0
down vote
Japt, 20 bytes
A³ò#〈 ms f_¬x ¥9©Zø0
A³ò#〈 ms f_¬x ¥9©Zø0 Full program
A³ò#〈 Range from [1000 9001)
ms Convert to string
f_ Filter values that
¬x ¥9 Sum equal to 9
©Zø0 And contains at least one 0
Try it online!
Japt, 20 bytes
A³ò#〈 ms f_¬x ¥9©Zø0
A³ò#〈 ms f_¬x ¥9©Zø0 Full program
A³ò#〈 Range from [1000 9001)
ms Convert to string
f_ Filter values that
¬x ¥9 Sum equal to 9
©Zø0 And contains at least one 0
Try it online!
edited 4 mins ago
answered 11 mins ago


Luis felipe De jesus Munoz
3,25111049
3,25111049
add a comment |Â
add a comment |Â
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
StackExchange.ready(
function ()
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fcodegolf.stackexchange.com%2fquestions%2f174049%2flist-all-possible-titles-for-the-anno-games%23new-answer', 'question_page');
);
Post as a guest
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Sign up using Google
Sign up using Facebook
Sign up using Email and Password