Edit #4: Hijacking the top of my answer to explain how I got my final answer. I wrote an R Script which I then had to re-run five more times, each time tweaking the initial information based on the information obtained from each run.
The trick is in setting up the initial conditions for the for loops to account for information you learned from the previous run of the script, so I will only include the snippets of those for loops.
Initial for loop:
for(N in 6:14){
for(i in 2:N){
for(j in 2:N){
for(k in 2:N){
data<-rbind(data,data.frame("N"=N,"Starks"=i,"Parks"=j,"Clarks"=k))
}
}
}
}
This gives the table of solutions:
Starks Parks Clarks House Number
4 2 3 24
5 2 3 30
6 2 3 36
5 2 4 40
7 2 3 42
6 2 4 48
8 2 3 48
9 2 3 54
7 2 4 56
5 3 4 60
6 2 5 60
8 2 4 64
7 2 5 70
6 3 4 72
7 3 4 84
6 3 5 90
From this table of possible solutions, we can see that Starks has 4-9 kids, Parks has 2-3, and Clarks has 3-5.
So the new for loop is:
for(N in 9:14){
for(i in 4:9){
for(j in 2:3){
for(k in 3:5){
data<-rbind(data,data.frame("N"=N,"Starks"=i,"Parks"=j,"Clarks"=k))
}
}
}
}
Giving table:
Starks Parks Clarks House Number
6 2 3 36
5 2 4 40
6 2 4 48
8 2 3 48
9 2 3 54
5 3 4 60
6 2 5 60
6 3 4 72
From this set of possible solutions, we learn that Starks has 5-9, and that there are 11-14 kids. So the new for loop is:
for(N in 11:14){
for(i in 5:9){
for(j in 2:3){
for(k in 3:5){
data<-rbind(data,data.frame("N"=N,"Starks"=i,"Parks"=j,"Clarks"=k))
}
}
}
}
Yielding:
Starks Parks Clarks House Number
6 2 4 48
8 2 3 48
9 2 3 54
5 3 4 60
6 2 5 60
6 3 4 72
Now we employ the second hint and selectively remove house number 60, eliminating the solution where Stark has 5. We can do this because 60 has two solutions, so we know it can't be 60. So the new for loop is:
for(N in 12:14){
for(i in 6:9){
for(j in 2:3){
for(k in 3:5){
data<-rbind(data,data.frame("N"=N,"Starks"=i,"Parks"=j,"Clarks"=k))
}
}
}
}
Yielding:
Starks Parks Clarks House Number
6 2 4 48
8 2 3 48
9 2 3 54
6 3 4 72
The final step now is to selectively remove house number 48, since we know it cannot be that one. This means stark has 6 or 9 kids, so the new for loop is:
for(N in 12:14){
for(i in c(6,9)){
for(j in 2:3){
for(k in 3:5){
data<-rbind(data,data.frame("N"=N,"Starks"=i,"Parks"=j,"Clarks"=k))
}
}
}
}
Yielding:
S: 9
P: 2
C: 3
HN: 54
Finally just one possible solution remains.
Original Post: I've found 19 solutions which satisfy the information given. The only thing missing is the house number.
S P C HN
3 1 2 6
4 1 2 8
5 1 2 10
7 1 2 14
5 1 3 15
8 1 2 16
7 1 3 21
11 1 2 22
9 1 3 27
7 1 4 28
8 1 4 32
7 1 5 35
9 2 3 54
7 2 4 56
8 2 4 64
7 2 5 70
6 3 4 72
7 3 4 84
6 3 5 90
Here is the R Script I wrote to generate the table:
data<-data.frame(matrix(ncol = 1,nrow = 1))
data$N<-NA
data$Starks<-NA
data$Parks<-NA
data$Clarks<-NA
data$matrix.ncol...1..nrow...1.<-NULL
#Generates list of all possible combinations of three numbers from 1 to 14
for(N in 6:14){
for(i in 1:N){
for(j in 1:N){
for(k in 1:N){
data<-rbind(data,data.frame("N"=N,"Starks"=i,"Parks"=j,"Clarks"=k))
}
}
}
}
#Sums kids
data$sum<-data$Starks+data$Parks+data$Clarks
#Eliminates out of bounds sums
data<-data[data$sum>5&data$sum<15,]
#Retrieves combinations within conditions given
data<-data[data$Parks<data$Clarks&data$Clarks<data$Starks,]
data<-data[!is.na(data$N),]
#Creates House Numbers for each combination
data$product<-data$Starks*data$Parks*data$Clarks
data<-data[order(data$product),]
#Eliminates combinations where N!=sum
data<-data[data$N==data$sum,]
data$occurences<-NA
#Counts House Number occurences
for (i in 1:length(data$product)) {
data$occurences[i]<-length(data[data$product[i]==data$product,"N"])
}
#Eliminates house numbers occuring more than once
data<-data[data$occurences==1,]
colnames(data)[6]<-"House Number"
Kids<-data[,c(2,3,4,6)]
Edit: After assuming each family has at least two kids, the solution is still greater than one, but changes a bit.
Starks Parks Clarks House Number
758 5 2 3 30
1644 6 2 3 36
1545 5 2 4 40
2849 7 2 3 42
6486 9 2 3 54
4296 7 2 4 56
6318 8 2 4 64
6150 7 2 5 70
4164 6 3 4 72
6162 7 3 4 84
5994 6 3 5 90
Sorry if that table doesn’t format, I used the R compiler from my phone.
Certain solutions become unique that weren’t unique before because house numbers and sums that contained 1 kid were eliminated.
Edit #2: Assuming John has an R compiler in his head, he can re-run his code to account for newly learned information. First, he runs the code assuming each family has at least two kids. This gives a starting for loop:
for(N in 6:14){
for(i in 2:N){
for(j in 2:N){
for(k in 2:N){
data<-rbind(data,data.frame("N"=N,"Starks"=i,"Parks"=j,"Clarks"=k))
}
}
}
}
Running the script with this loop gives the last table I added to this increasingly long post. But after the last clue, John can assume the Starks have at least 4 kids, and the Clarks have at least 3. Rerunning the Script in his mind, he gets this solution set:
Starks Parks Clarks House Number
6 2 3 36
5 2 4 40
9 2 3 54
7 2 4 56
8 2 4 64
7 2 5 70
6 3 4 72
7 3 4 84
6 3 5 90
But now he knows that the Starks have at least five kids, the Parks have two or three, and the Clarks have 3 to 5. So we change our loop at the beginning of the Script and that gives two solutions:
Starks Parks Clarks House Number
9 2 3 54
6 3 4 72
Running the script again with this information yields no new info. So we've got it down to two possible solutions.
Edit #3: I believe I have solved it.
Starks: 9, Parks: 2, Clarks: 3, House Number 54.I modified my script so that it does not immediately dismiss solutions coming from the same house number, and it eventually gets down to only one possible solution.
Edit #5: Here is the entire R Script that outputs "Kids6" as the solution:
data<-data.frame(matrix(ncol = 1,nrow = 1))
data$N<-NA
data$Starks<-NA
data$Parks<-NA
data$Clarks<-NA
data$matrix.ncol...1..nrow...1.<-NULL
for(N in 6:14){
for(i in 2:N){
for(j in 2:N){
for(k in 2:N){
data<-rbind(data,data.frame("N"=N,"Starks"=i,"Parks"=j,"Clarks"=k))
}
}
}
}
data$sum<-data$Starks+data$Parks+data$Clarks
data<-data[data$sum<15,]
data<-data[!is.na(data$N),]
data<-data[data$N==data$sum,]
data$product<-data$Starks*data$Parks*data$Clarks
data<-data[order(data$product),]
data$occurences<-NA
for (i in 1:length(data$product)) {
data$occurences[i]<-length(data[data$product[i]==data$product,"N"])
}
data<-data[data$occurences!=1,]
data<-data[data$Parks<data$Clarks,]
data<-data[data$Clarks<data$Starks,]
for (i in 1:length(data$product)) {
data$occurences[i]<-length(data[data$product[i]==data$product,"N"])
}
#data<-data[data$occurences==1,]
colnames(data)[6]<-"House Number"
Kids1<-data[,c(2,3,4,6)]
data<-data.frame(matrix(ncol = 1,nrow = 1))
data$N<-NA
data$Starks<-NA
data$Parks<-NA
data$Clarks<-NA
data$matrix.ncol...1..nrow...1.<-NULL
for(N in 9:14){
for(i in 4:9){
for(j in 2:3){
for(k in 3:5){
data<-rbind(data,data.frame("N"=N,"Starks"=i,"Parks"=j,"Clarks"=k))
}
}
}
}
data$sum<-data$Starks+data$Parks+data$Clarks
data<-data[data$sum<15,]
data<-data[!is.na(data$N),]
data<-data[data$N==data$sum,]
data$product<-data$Starks*data$Parks*data$Clarks
data<-data[order(data$product),]
data$occurences<-NA
for (i in 1:length(data$product)) {
data$occurences[i]<-length(data[data$product[i]==data$product,"N"])
}
data<-data[data$occurences!=1,]
data<-data[data$Parks<data$Clarks,]
data<-data[data$Clarks<data$Starks,]
for (i in 1:length(data$product)) {
data$occurences[i]<-length(data[data$product[i]==data$product,"N"])
}
#data<-data[data$occurences==1,]
colnames(data)[6]<-"House Number"
Kids2<-data[,c(2,3,4,6)]
data<-data.frame(matrix(ncol = 1,nrow = 1))
data$N<-NA
data$Starks<-NA
data$Parks<-NA
data$Clarks<-NA
data$matrix.ncol...1..nrow...1.<-NULL
for(N in 11:14){
for(i in 5:9){
for(j in 2:3){
for(k in 3:5){
data<-rbind(data,data.frame("N"=N,"Starks"=i,"Parks"=j,"Clarks"=k))
}
}
}
}
data$sum<-data$Starks+data$Parks+data$Clarks
data<-data[data$sum<15,]
data<-data[!is.na(data$N),]
data<-data[data$N==data$sum,]
data$product<-data$Starks*data$Parks*data$Clarks
data<-data[order(data$product),]
data$occurences<-NA
for (i in 1:length(data$product)) {
data$occurences[i]<-length(data[data$product[i]==data$product,"N"])
}
data<-data[data$occurences!=1,]
data<-data[data$Parks<data$Clarks,]
data<-data[data$Clarks<data$Starks,]
for (i in 1:length(data$product)) {
data$occurences[i]<-length(data[data$product[i]==data$product,"N"])
}
#data<-data[data$occurences==1,]
colnames(data)[6]<-"House Number"
Kids3<-data[,c(2,3,4,6)]
data<-data.frame(matrix(ncol = 1,nrow = 1))
data$N<-NA
data$Starks<-NA
data$Parks<-NA
data$Clarks<-NA
data$matrix.ncol...1..nrow...1.<-NULL
for(N in 12:14){
for(i in 6:9){
for(j in 2:3){
for(k in 3:5){
data<-rbind(data,data.frame("N"=N,"Starks"=i,"Parks"=j,"Clarks"=k))
}
}
}
}
data$sum<-data$Starks+data$Parks+data$Clarks
data<-data[data$sum<15,]
data<-data[!is.na(data$N),]
data<-data[data$N==data$sum,]
data$product<-data$Starks*data$Parks*data$Clarks
data<-data[order(data$product),]
data$occurences<-NA
for (i in 1:length(data$product)) {
data$occurences[i]<-length(data[data$product[i]==data$product,"N"])
}
data<-data[data$occurences!=1,]
data<-data[data$Parks<data$Clarks,]
data<-data[data$Clarks<data$Starks,]
for (i in 1:length(data$product)) {
data$occurences[i]<-length(data[data$product[i]==data$product,"N"])
}
#data<-data[data$occurences==1,]
colnames(data)[6]<-"House Number"
Kids5<-data[,c(2,3,4,6)]
data<-data.frame(matrix(ncol = 1,nrow = 1))
data$N<-NA
data$Starks<-NA
data$Parks<-NA
data$Clarks<-NA
data$matrix.ncol...1..nrow...1.<-NULL
for(N in 12:14){
for(i in c(6,9)){
for(j in 2:3){
for(k in 3:5){
data<-rbind(data,data.frame("N"=N,"Starks"=i,"Parks"=j,"Clarks"=k))
}
}
}
}
data$sum<-data$Starks+data$Parks+data$Clarks
data<-data[data$sum<15,]
data<-data[!is.na(data$N),]
data<-data[data$N==data$sum,]
data$product<-data$Starks*data$Parks*data$Clarks
data<-data[order(data$product),]
data$occurences<-NA
for (i in 1:length(data$product)) {
data$occurences[i]<-length(data[data$product[i]==data$product,"N"])
}
data<-data[data$occurences!=1,]
data<-data[data$Parks<data$Clarks,]
data<-data[data$Clarks<data$Starks,]
for (i in 1:length(data$product)) {
data$occurences[i]<-length(data[data$product[i]==data$product,"N"])
}
#data<-data[data$occurences==1,]
colnames(data)[6]<-"House Number"
Kids6<-data[,c(2,3,4,6)]