import numpy as np
train_sequence = [1, 3, 7, 8, 21, 49, 76, 224, 467, 514, 1155, 2683, 5216, 10544, 26867, 51510, 95823, 198669, 357535, 863317, 1811764, 3007503, 5598802, 14428676, 33185509, 54538862, 111949941, 227634408, 400708894, 1033162084, 2102388551, 3093472814, 7137437912, 14133072157, 20112871792, 42387769980, 100251560595, 146971536592, 323724968937, 1003651412950, 1458252205147, 2895374552463, 7409811047825, 15404761757071, 19996463086597, 51408670348612, 119666659114170, 191206974700443, 409118905032525, 611140496167764, 2058769515153876, 4216495639600700, 6763683971478124, 9974455244496707, 30045390491869460, 44218742292676575, 138245758910846492, 199976667976342049, 525070384258266191, 1135041350219496382, 1425787542618654982, 3908372542507822062, 8993229949524469768, 17799667357578236628, 30568377312064202855]
X_train = np.array([[2**i] for i in range(len(train_sequence))]) # Powers of 2
y_train = np.array(train_sequence)
model = LinearRegression()
model.fit(X_train, y_train)
i = 1
for i in range(len(train_sequence), 256):
next_number = model.predict([[2**i]])
next_number_decimal = int(next_number)
next_number_hex = hex(next_number_decimal)
print("Puzzle : "+str(i)+" hexadecimal is:", next_number_hex)
#print("The next number in the sequence (hexadecimal) is:", next_number_hex)
#print("The next number in the sequence (decimal) is:", next_number_decimal)
train_sequence.append(next_number_decimal)
X_train = np.vstack([X_train, [2**i]])
y_train = np.append(y_train, next_number_decimal)
model.fit(X_train, y_train)
The line from sklearn.linear_model import LinearRegression is importing the LinearRegression class from the linear_model module of the scikit-learn. which is a popular machine learning library in Python that provides various tools and algorithms for data analysis, The LinearRegression class is used to create an instance of a linear regression model. This model is then trained on the provided training_data (X_train and y_train) using the fit() method, which fits the linear regression line to the given data points. Once the model is trained, it can be used to make predictions on new data points using the predict() method. However, in this particular case, the model may not be able to make predictions for the next numbers in the sequence, not even close or far. The predictions generated by the model appear to be the same for each number up to 256, indicating that the model may not be capturing the underlying pattern in the sequence effectively. Consequent, it seems that the model is not useful for predicting the next numbers in the sequence beyond the provided training data. here all prediction 66 to 256, useless
Puzzle : 66 hexadecimal is: 0x370ce49e46646a000
Puzzle : 67 hexadecimal is: 0x6e15318735d5b8000
Puzzle : 68 hexadecimal is: 0xdc25cb5914b880000
Puzzle : 69 hexadecimal is: 0x1b846fefcd27e20000
Puzzle : 70 hexadecimal is: 0x3708966444e0900000
Puzzle : 71 hexadecimal is: 0x6e10e34d3451f00000
Puzzle : 72 hexadecimal is: 0xdc217d1f1334b00000
Puzzle : 73 hexadecimal is: 0x1b842b0c2d0fa200000
Puzzle : 74 hexadecimal is: 0x37085180a4c85000000
Puzzle : 75 hexadecimal is: 0x6e109e699439a400000
Puzzle : 76 hexadecimal is: 0xdc21383b731c5800000
Puzzle : 77 hexadecimal is: 0x1b8426bdf30e1c000000
Puzzle : 78 hexadecimal is: 0x37084d326ac6c6000000
Puzzle : 79 hexadecimal is: 0x6e109a1b5a3808000000
Puzzle : 80 hexadecimal is: 0xdc2133ed391ab8000000
Puzzle : 81 hexadecimal is: 0x1b8426790f6dfd0000000
Puzzle : 82 hexadecimal is: 0x37084ced8726a60000000
Puzzle : 83 hexadecimal is: 0x6e1099d67698080000000
Puzzle : 84 hexadecimal is: 0xdc2133a8557a900000000
Puzzle : 85 hexadecimal is: 0x1b842674c133fc00000000
Puzzle : 86 hexadecimal is: 0x37084ce938eca600000000
Puzzle : 87 hexadecimal is: 0x6e1099d2285df800000000
Puzzle : 88 hexadecimal is: 0xdc2133a407408800000000
Puzzle : 89 hexadecimal is: 0x1b8426747c505b000000000
Puzzle : 90 hexadecimal is: 0x37084ce8f40904000000000
Puzzle : 91 hexadecimal is: 0x6e1099d1e37a3c000000000
Puzzle : 92 hexadecimal is: 0xdc2133a3c25ce8000000000
Puzzle : 93 hexadecimal is: 0x1b8426747802200000000000
Puzzle : 94 hexadecimal is: 0x37084ce8efbac80000000000
Puzzle : 95 hexadecimal is: 0x6e1099d1df2c1c0000000000
Puzzle : 96 hexadecimal is: 0xdc2133a3be0ed00000000000
Puzzle : 97 hexadecimal is: 0x1b84267477bd4200000000000
Puzzle : 98 hexadecimal is: 0x37084ce8ef75ee00000000000
Puzzle : 99 hexadecimal is: 0x6e1099d1dee73400000000000
Puzzle : 100 hexadecimal is: 0xdc2133a3bdc9d000000000000
Puzzle : 101 hexadecimal is: 0x1b84267477b8f2000000000000
Puzzle : 102 hexadecimal is: 0x37084ce8ef71a2000000000000
Puzzle : 103 hexadecimal is: 0x6e1099d1dee2ec000000000000
Puzzle : 104 hexadecimal is: 0xdc2133a3bdc5a8000000000000
Puzzle : 105 hexadecimal is: 0x1b84267477b8af0000000000000
Puzzle : 106 hexadecimal is: 0x37084ce8ef715a0000000000000
Puzzle : 107 hexadecimal is: 0x6e1099d1dee2bc0000000000000
Puzzle : 108 hexadecimal is: 0xdc2133a3bdc5600000000000000
Puzzle : 109 hexadecimal is: 0x1b84267477b8a900000000000000
Puzzle : 110 hexadecimal is: 0x37084ce8ef715400000000000000
Puzzle : 111 hexadecimal is: 0x6e1099d1dee29800000000000000
Puzzle : 112 hexadecimal is: 0xdc2133a3bdc52800000000000000
Puzzle : 113 hexadecimal is: 0x1b84267477b8a6000000000000000
Puzzle : 114 hexadecimal is: 0x37084ce8ef714e000000000000000
Puzzle : 115 hexadecimal is: 0x6e1099d1dee2a0000000000000000
Puzzle : 116 hexadecimal is: 0xdc2133a3bdc538000000000000000
Puzzle : 117 hexadecimal is: 0x1b84267477b8a90000000000000000
Puzzle : 118 hexadecimal is: 0x37084ce8ef71520000000000000000
Puzzle : 119 hexadecimal is: 0x6e1099d1dee2a00000000000000000
Puzzle : 120 hexadecimal is: 0xdc2133a3bdc5680000000000000000
Puzzle : 121 hexadecimal is: 0x1b84267477b8ac00000000000000000
Puzzle : 122 hexadecimal is: 0x37084ce8ef715c00000000000000000
Puzzle : 123 hexadecimal is: 0x6e1099d1dee2b000000000000000000
Puzzle : 124 hexadecimal is: 0xdc2133a3bdc56800000000000000000
Puzzle : 125 hexadecimal is: 0x1b84267477b8ae000000000000000000
Puzzle : 126 hexadecimal is: 0x37084ce8ef715a000000000000000000
Puzzle : 127 hexadecimal is: 0x6e1099d1dee2b4000000000000000000
Puzzle : 128 hexadecimal is: 0xdc2133a3bdc558000000000000000000
Puzzle : 129 hexadecimal is: 0x1b84267477b8a90000000000000000000
Puzzle : 130 hexadecimal is: 0x37084ce8ef71500000000000000000000
Puzzle : 131 hexadecimal is: 0x6e1099d1dee2ac0000000000000000000
Puzzle : 132 hexadecimal is: 0xdc2133a3bdc5480000000000000000000
Puzzle : 133 hexadecimal is: 0x1b84267477b8a600000000000000000000
Puzzle : 134 hexadecimal is: 0x37084ce8ef714a00000000000000000000
Puzzle : 135 hexadecimal is: 0x6e1099d1dee2a000000000000000000000
Puzzle : 136 hexadecimal is: 0xdc2133a3bdc53000000000000000000000
Puzzle : 137 hexadecimal is: 0x1b84267477b8a6000000000000000000000
Puzzle : 138 hexadecimal is: 0x37084ce8ef7148000000000000000000000
Puzzle : 139 hexadecimal is: 0x6e1099d1dee28c000000000000000000000
Puzzle : 140 hexadecimal is: 0xdc2133a3bdc530000000000000000000000
Puzzle : 141 hexadecimal is: 0x1b84267477b8a80000000000000000000000
Puzzle : 142 hexadecimal is: 0x37084ce8ef714e0000000000000000000000
Puzzle : 143 hexadecimal is: 0x6e1099d1dee2a40000000000000000000000
Puzzle : 144 hexadecimal is: 0xdc2133a3bdc5480000000000000000000000
Puzzle : 145 hexadecimal is: 0x1b84267477b8a600000000000000000000000
Puzzle : 146 hexadecimal is: 0x37084ce8ef714a00000000000000000000000
Puzzle : 147 hexadecimal is: 0x6e1099d1dee29c00000000000000000000000
Puzzle : 148 hexadecimal is: 0xdc2133a3bdc52800000000000000000000000
Puzzle : 149 hexadecimal is: 0x1b84267477b8a3000000000000000000000000
Puzzle : 150 hexadecimal is: 0x37084ce8ef7144000000000000000000000000
Puzzle : 151 hexadecimal is: 0x6e1099d1dee294000000000000000000000000
Puzzle : 152 hexadecimal is: 0xdc2133a3bdc510000000000000000000000000
Puzzle : 153 hexadecimal is: 0x1b84267477b8a30000000000000000000000000
Puzzle : 154 hexadecimal is: 0x37084ce8ef71400000000000000000000000000
Puzzle : 155 hexadecimal is: 0x6e1099d1dee2840000000000000000000000000
Puzzle : 156 hexadecimal is: 0xdc2133a3bdc4f00000000000000000000000000
Puzzle : 157 hexadecimal is: 0x1b84267477b8a100000000000000000000000000
Puzzle : 158 hexadecimal is: 0x37084ce8ef714400000000000000000000000000
Puzzle : 159 hexadecimal is: 0x6e1099d1dee28000000000000000000000000000
Puzzle : 160 hexadecimal is: 0xdc2133a3bdc51000000000000000000000000000
Puzzle : 161 hexadecimal is: 0x1b84267477b8a0000000000000000000000000000
Puzzle : 162 hexadecimal is: 0x37084ce8ef7140000000000000000000000000000
Puzzle : 163 hexadecimal is: 0x6e1099d1dee278000000000000000000000000000
Puzzle : 164 hexadecimal is: 0xdc2133a3bdc4e8000000000000000000000000000
Puzzle : 165 hexadecimal is: 0x1b84267477b89e0000000000000000000000000000
Puzzle : 166 hexadecimal is: 0x37084ce8ef71380000000000000000000000000000
Puzzle : 167 hexadecimal is: 0x6e1099d1dee26c0000000000000000000000000000
Puzzle : 168 hexadecimal is: 0xdc2133a3bdc4d00000000000000000000000000000
Puzzle : 169 hexadecimal is: 0x1b84267477b89c00000000000000000000000000000
Puzzle : 170 hexadecimal is: 0x37084ce8ef713600000000000000000000000000000
Puzzle : 171 hexadecimal is: 0x6e1099d1dee26c00000000000000000000000000000
Puzzle : 172 hexadecimal is: 0xdc2133a3bdc4c000000000000000000000000000000
Puzzle : 173 hexadecimal is: 0x1b84267477b89a000000000000000000000000000000
Puzzle : 174 hexadecimal is: 0x37084ce8ef7136000000000000000000000000000000
Puzzle : 175 hexadecimal is: 0x6e1099d1dee274000000000000000000000000000000
Puzzle : 176 hexadecimal is: 0xdc2133a3bdc4d0000000000000000000000000000000
Puzzle : 177 hexadecimal is: 0x1b84267477b89e0000000000000000000000000000000
Puzzle : 178 hexadecimal is: 0x37084ce8ef71360000000000000000000000000000000
Puzzle : 179 hexadecimal is: 0x6e1099d1dee2700000000000000000000000000000000
Puzzle : 180 hexadecimal is: 0xdc2133a3bdc4c80000000000000000000000000000000
Puzzle : 181 hexadecimal is: 0x1b84267477b89900000000000000000000000000000000
Puzzle : 182 hexadecimal is: 0x37084ce8ef713200000000000000000000000000000000
Puzzle : 183 hexadecimal is: 0x6e1099d1dee25c00000000000000000000000000000000
Puzzle : 184 hexadecimal is: 0xdc2133a3bdc4c000000000000000000000000000000000
Puzzle : 185 hexadecimal is: 0x1b84267477b89c000000000000000000000000000000000
Puzzle : 186 hexadecimal is: 0x37084ce8ef7138000000000000000000000000000000000
Puzzle : 187 hexadecimal is: 0x6e1099d1dee274000000000000000000000000000000000
Puzzle : 188 hexadecimal is: 0xdc2133a3bdc4c8000000000000000000000000000000000
Puzzle : 189 hexadecimal is: 0x1b84267477b89b0000000000000000000000000000000000
Puzzle : 190 hexadecimal is: 0x37084ce8ef71360000000000000000000000000000000000
Puzzle : 191 hexadecimal is: 0x6e1099d1dee26c0000000000000000000000000000000000
Puzzle : 192 hexadecimal is: 0xdc2133a3bdc4d00000000000000000000000000000000000
Puzzle : 193 hexadecimal is: 0x1b84267477b89e00000000000000000000000000000000000
Puzzle : 194 hexadecimal is: 0x37084ce8ef713600000000000000000000000000000000000
Puzzle : 195 hexadecimal is: 0x6e1099d1dee27000000000000000000000000000000000000
Puzzle : 196 hexadecimal is: 0xdc2133a3bdc4d800000000000000000000000000000000000
Puzzle : 197 hexadecimal is: 0x1b84267477b899000000000000000000000000000000000000
Puzzle : 198 hexadecimal is: 0x37084ce8ef7136000000000000000000000000000000000000
Puzzle : 199 hexadecimal is: 0x6e1099d1dee274000000000000000000000000000000000000
Puzzle : 200 hexadecimal is: 0xdc2133a3bdc4e0000000000000000000000000000000000000
Puzzle : 201 hexadecimal is: 0x1b84267477b8980000000000000000000000000000000000000
Puzzle : 202 hexadecimal is: 0x37084ce8ef712e0000000000000000000000000000000000000
Puzzle : 203 hexadecimal is: 0x6e1099d1dee2500000000000000000000000000000000000000
Puzzle : 204 hexadecimal is: 0xdc2133a3bdc4900000000000000000000000000000000000000
Puzzle : 205 hexadecimal is: 0x1b84267477b89000000000000000000000000000000000000000
Puzzle : 206 hexadecimal is: 0x37084ce8ef711800000000000000000000000000000000000000
Puzzle : 207 hexadecimal is: 0x6e1099d1dee24000000000000000000000000000000000000000
Puzzle : 208 hexadecimal is: 0xdc2133a3bdc47000000000000000000000000000000000000000
Puzzle : 209 hexadecimal is: 0x1b84267477b88e000000000000000000000000000000000000000
Puzzle : 210 hexadecimal is: 0x37084ce8ef7118000000000000000000000000000000000000000
Puzzle : 211 hexadecimal is: 0x6e1099d1dee22c000000000000000000000000000000000000000
Puzzle : 212 hexadecimal is: 0xdc2133a3bdc460000000000000000000000000000000000000000
Puzzle : 213 hexadecimal is: 0x1b84267477b88b0000000000000000000000000000000000000000
Puzzle : 214 hexadecimal is: 0x37084ce8ef71160000000000000000000000000000000000000000
Puzzle : 215 hexadecimal is: 0x6e1099d1dee23c0000000000000000000000000000000000000000
Puzzle : 216 hexadecimal is: 0xdc2133a3bdc4700000000000000000000000000000000000000000
Puzzle : 217 hexadecimal is: 0x1b84267477b89000000000000000000000000000000000000000000
Puzzle : 218 hexadecimal is: 0x37084ce8ef712400000000000000000000000000000000000000000
Puzzle : 219 hexadecimal is: 0x6e1099d1dee23400000000000000000000000000000000000000000
Puzzle : 220 hexadecimal is: 0xdc2133a3bdc47000000000000000000000000000000000000000000
Puzzle : 221 hexadecimal is: 0x1b84267477b891000000000000000000000000000000000000000000
Puzzle : 222 hexadecimal is: 0x37084ce8ef712c000000000000000000000000000000000000000000
Puzzle : 223 hexadecimal is: 0x6e1099d1dee258000000000000000000000000000000000000000000
Puzzle : 224 hexadecimal is: 0xdc2133a3bdc4b0000000000000000000000000000000000000000000
Puzzle : 225 hexadecimal is: 0x1b84267477b8960000000000000000000000000000000000000000000
Puzzle : 226 hexadecimal is: 0x37084ce8ef71320000000000000000000000000000000000000000000
Puzzle : 227 hexadecimal is: 0x6e1099d1dee25c0000000000000000000000000000000000000000000
Puzzle : 228 hexadecimal is: 0xdc2133a3bdc4b00000000000000000000000000000000000000000000
Puzzle : 229 hexadecimal is: 0x1b84267477b89700000000000000000000000000000000000000000000
Puzzle : 230 hexadecimal is: 0x37084ce8ef712e00000000000000000000000000000000000000000000
Puzzle : 231 hexadecimal is: 0x6e1099d1dee24c00000000000000000000000000000000000000000000
Puzzle : 232 hexadecimal is: 0xdc2133a3bdc4b000000000000000000000000000000000000000000000
Puzzle : 233 hexadecimal is: 0x1b84267477b893000000000000000000000000000000000000000000000
Puzzle : 234 hexadecimal is: 0x37084ce8ef7124000000000000000000000000000000000000000000000
Puzzle : 235 hexadecimal is: 0x6e1099d1dee240000000000000000000000000000000000000000000000
Puzzle : 236 hexadecimal is: 0xdc2133a3bdc490000000000000000000000000000000000000000000000
Puzzle : 237 hexadecimal is: 0x1b84267477b8930000000000000000000000000000000000000000000000
Puzzle : 238 hexadecimal is: 0x37084ce8ef71260000000000000000000000000000000000000000000000
Puzzle : 239 hexadecimal is: 0x6e1099d1dee2440000000000000000000000000000000000000000000000
Puzzle : 240 hexadecimal is: 0xdc2133a3bdc4680000000000000000000000000000000000000000000000
Puzzle : 241 hexadecimal is: 0x1b84267477b88e00000000000000000000000000000000000000000000000
Puzzle : 242 hexadecimal is: 0x37084ce8ef711e00000000000000000000000000000000000000000000000
Puzzle : 243 hexadecimal is: 0x6e1099d1dee22c00000000000000000000000000000000000000000000000
Puzzle : 244 hexadecimal is: 0xdc2133a3bdc46800000000000000000000000000000000000000000000000
Puzzle : 245 hexadecimal is: 0x1b84267477b891000000000000000000000000000000000000000000000000
Puzzle : 246 hexadecimal is: 0x37084ce8ef7124000000000000000000000000000000000000000000000000
Puzzle : 247 hexadecimal is: 0x6e1099d1dee244000000000000000000000000000000000000000000000000
Puzzle : 248 hexadecimal is: 0xdc2133a3bdc468000000000000000000000000000000000000000000000000
Puzzle : 249 hexadecimal is: 0x1b84267477b88d0000000000000000000000000000000000000000000000000
Puzzle : 250 hexadecimal is: 0x37084ce8ef711e0000000000000000000000000000000000000000000000000
Puzzle : 251 hexadecimal is: 0x6e1099d1dee2400000000000000000000000000000000000000000000000000
Puzzle : 252 hexadecimal is: 0xdc2133a3bdc4980000000000000000000000000000000000000000000000000
Puzzle : 253 hexadecimal is: 0x1b84267477b88f00000000000000000000000000000000000000000000000000
Puzzle : 254 hexadecimal is: 0x37084ce8ef711a00000000000000000000000000000000000000000000000000
Puzzle : 255 hexadecimal is: 0x6e1099d1dee22c00000000000000000000000000000000000000000000000000
Puzzle : 256 hexadecimal is: 0xdc2133a3bdc45000000000000000000000000000000000000000000000000000
If you need to check predictions below 66, you can exclude the decimal numbers of like (64 and 65) from the training data and and check predictions as well.