[–] karthikm 16y ago ↗ 1,2,4,8,16,32,64,128,256,512 [–] andrewpbrett 16y ago ↗ oh, jeez, just saw this. face palm
[–] andrewpbrett 16y ago ↗ That's kind of interesting - I wonder why that sequence is off and yet:0,1,2,4,8,16,32,64,128,256and0,1,2,4,8,16,32,64,128,256,512,1024come back accurately. [–] cperciva 16y ago ↗ I wonder why...Because you need to beat Alpha over the head with data in order to convince it to say "well, maybe the first value just doesn't fit the pattern".As a mathematician, I'd say that Alpha's approach here is entirely reasonable. [–] andrewpbrett 16y ago ↗ right, but my point was that if you give it one less data point, i.e.0,1,2,4,8,16,32,64,128,256it detects the pattern, but if you tack on the 512 it duffs it. [–] graywh 16y ago ↗ I think b/c it's using the difference table method in both cases. Where as, if the pattern starts with 1, it recognizes it as powers of 2.R code: solver <- function(x) { print(x) if (length(x) == 0 || all(x == 0)) 0 else x[length(x)] + solver(diff(x)) } solver(c(0,1,2,4,8,16,32,64,128)) #=> 255 solver(c(0,1,2,4,8,16,32,64,128,256)) #=> 512 solver(c(0,1,2,4,8,16,32,64,128,256,512)) #=> 1023 solver(c(0,1,2,4,8,16,32,64,128,26,512,1024)) #=> 2048
[–] cperciva 16y ago ↗ I wonder why...Because you need to beat Alpha over the head with data in order to convince it to say "well, maybe the first value just doesn't fit the pattern".As a mathematician, I'd say that Alpha's approach here is entirely reasonable. [–] andrewpbrett 16y ago ↗ right, but my point was that if you give it one less data point, i.e.0,1,2,4,8,16,32,64,128,256it detects the pattern, but if you tack on the 512 it duffs it. [–] graywh 16y ago ↗ I think b/c it's using the difference table method in both cases. Where as, if the pattern starts with 1, it recognizes it as powers of 2.R code: solver <- function(x) { print(x) if (length(x) == 0 || all(x == 0)) 0 else x[length(x)] + solver(diff(x)) } solver(c(0,1,2,4,8,16,32,64,128)) #=> 255 solver(c(0,1,2,4,8,16,32,64,128,256)) #=> 512 solver(c(0,1,2,4,8,16,32,64,128,256,512)) #=> 1023 solver(c(0,1,2,4,8,16,32,64,128,26,512,1024)) #=> 2048
[–] andrewpbrett 16y ago ↗ right, but my point was that if you give it one less data point, i.e.0,1,2,4,8,16,32,64,128,256it detects the pattern, but if you tack on the 512 it duffs it. [–] graywh 16y ago ↗ I think b/c it's using the difference table method in both cases. Where as, if the pattern starts with 1, it recognizes it as powers of 2.R code: solver <- function(x) { print(x) if (length(x) == 0 || all(x == 0)) 0 else x[length(x)] + solver(diff(x)) } solver(c(0,1,2,4,8,16,32,64,128)) #=> 255 solver(c(0,1,2,4,8,16,32,64,128,256)) #=> 512 solver(c(0,1,2,4,8,16,32,64,128,256,512)) #=> 1023 solver(c(0,1,2,4,8,16,32,64,128,26,512,1024)) #=> 2048
[–] graywh 16y ago ↗ I think b/c it's using the difference table method in both cases. Where as, if the pattern starts with 1, it recognizes it as powers of 2.R code: solver <- function(x) { print(x) if (length(x) == 0 || all(x == 0)) 0 else x[length(x)] + solver(diff(x)) } solver(c(0,1,2,4,8,16,32,64,128)) #=> 255 solver(c(0,1,2,4,8,16,32,64,128,256)) #=> 512 solver(c(0,1,2,4,8,16,32,64,128,256,512)) #=> 1023 solver(c(0,1,2,4,8,16,32,64,128,26,512,1024)) #=> 2048
6 comments
[ 2.5 ms ] story [ 25.8 ms ] thread0,1,2,4,8,16,32,64,128,256
and
0,1,2,4,8,16,32,64,128,256,512,1024
come back accurately.
Because you need to beat Alpha over the head with data in order to convince it to say "well, maybe the first value just doesn't fit the pattern".
As a mathematician, I'd say that Alpha's approach here is entirely reasonable.
0,1,2,4,8,16,32,64,128,256
it detects the pattern, but if you tack on the 512 it duffs it.
R code: