commit 77b32f9e2c434a91a6a34a6869291ae144ba26e0 Author: Antonio De Lucreziis Date: Thu May 16 00:17:40 2024 +0200 initial commit diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..9b1ee42 --- /dev/null +++ b/.gitignore @@ -0,0 +1,175 @@ +# Based on https://raw.githubusercontent.com/github/gitignore/main/Node.gitignore + +# Logs + +logs +_.log +npm-debug.log_ +yarn-debug.log* +yarn-error.log* +lerna-debug.log* +.pnpm-debug.log* + +# Caches + +.cache + +# Diagnostic reports (https://nodejs.org/api/report.html) + +report.[0-9]_.[0-9]_.[0-9]_.[0-9]_.json + +# Runtime data + +pids +_.pid +_.seed +*.pid.lock + +# Directory for instrumented libs generated by jscoverage/JSCover + +lib-cov + +# Coverage directory used by tools like istanbul + +coverage +*.lcov + +# nyc test coverage + +.nyc_output + +# Grunt intermediate storage (https://gruntjs.com/creating-plugins#storing-task-files) + +.grunt + +# Bower dependency directory (https://bower.io/) + +bower_components + +# node-waf configuration + +.lock-wscript + +# Compiled binary addons (https://nodejs.org/api/addons.html) + +build/Release + +# Dependency directories + +node_modules/ +jspm_packages/ + +# Snowpack dependency directory (https://snowpack.dev/) + +web_modules/ + +# TypeScript cache + +*.tsbuildinfo + +# Optional npm cache directory + +.npm + +# Optional eslint cache + +.eslintcache + +# Optional stylelint cache + +.stylelintcache + +# Microbundle cache + +.rpt2_cache/ +.rts2_cache_cjs/ +.rts2_cache_es/ +.rts2_cache_umd/ + +# Optional REPL history + +.node_repl_history + +# Output of 'npm pack' + +*.tgz + +# Yarn Integrity file + +.yarn-integrity + +# dotenv environment variable files + +.env +.env.development.local +.env.test.local +.env.production.local +.env.local + +# parcel-bundler cache (https://parceljs.org/) + +.parcel-cache + +# Next.js build output + +.next +out + +# Nuxt.js build / generate output + +.nuxt +dist + +# Gatsby files + +# Comment in the public line in if your project uses Gatsby and not Next.js + +# https://nextjs.org/blog/next-9-1#public-directory-support + +# public + +# vuepress build output + +.vuepress/dist + +# vuepress v2.x temp and cache directory + +.temp + +# Docusaurus cache and generated files + +.docusaurus + +# Serverless directories + +.serverless/ + +# FuseBox cache + +.fusebox/ + +# DynamoDB Local files + +.dynamodb/ + +# TernJS port file + +.tern-port + +# Stores VSCode versions used for testing VSCode extensions + +.vscode-test + +# yarn v2 + +.yarn/cache +.yarn/unplugged +.yarn/build-state.yml +.yarn/install-state.gz +.pnp.* + +# IntelliJ based IDEs +.idea + +# Finder (MacOS) folder config +.DS_Store diff --git a/README.md b/README.md new file mode 100644 index 0000000..fe2ad12 --- /dev/null +++ b/README.md @@ -0,0 +1,24 @@ +# Shortest Sum of Squares + +This is a simple web application that shows a precomputed list of the shortest sum of squares for a given number. The list is +generated in Julia and then exported as a text file. The web application is built using Vite and SolidJS. + +## Usage + +### Setup + +```bash +bun install +``` + +### Development + +```bash +bun dev +``` + +### Build + +```bash +bun run build +``` diff --git a/bun.lockb b/bun.lockb new file mode 100755 index 0000000..f3caa8b Binary files /dev/null and b/bun.lockb differ diff --git a/index.html b/index.html new file mode 100644 index 0000000..af016ac --- /dev/null +++ b/index.html @@ -0,0 +1,13 @@ + + + + + + Shortest Sum of Squares + + + +
+ + + diff --git a/julia-scripts/generate-ssos.jl b/julia-scripts/generate-ssos.jl new file mode 100644 index 0000000..ebce979 --- /dev/null +++ b/julia-scripts/generate-ssos.jl @@ -0,0 +1,54 @@ +using Base +using DataStructures + +found = Dict{Int, Array{Int64}}() + +function count_nz(seq) + return length([i for i in seq if i > 0]) +end + +for i1 in 0:32 + for i2 in i1:32 + for i3 in i2:32 + for i4 in i3:32 + s = i1 ^ 2 + i2 ^ 2 + i3 ^ 2 + i4 ^ 2 + + if s <= 1000 + seq = [ i1, i2, i3, i4 ] + + # if !haskey(found, s) + # found[s] = seq + # end + + if haskey(found, s) + s_prev = found[s] + + if count_nz(seq) < count_nz(s_prev) + found[s] = seq + end + else + found[s] = seq + end + end + end + end + end +end + +found = sort(found) + +delete!(found, 0) + +# for i = 1:1000 +# if haskey(found, i) +# print("x") +# else +# print("_") +# end +# end + +for (sum, seq) in found + println("$(join(["$(i)^2" for i in seq if i > 0], " + ")) = $(sum)") +end + +# println(length([k for (k, v) in found if length([i for i in v if i != 0]) == 4])) diff --git a/package.json b/package.json new file mode 100644 index 0000000..aa6b4f1 --- /dev/null +++ b/package.json @@ -0,0 +1,25 @@ +{ + "name": "shortest-sum-of-squares", + "version": "0.0.1", + "description": "", + "type": "module", + "scripts": { + "start": "vite", + "dev": "vite", + "build": "vite build", + "serve": "vite preview" + }, + "license": "MIT", + "devDependencies": { + "@types/katex": "^0.16.7", + "solid-devtools": "^0.29.2", + "typescript": "^5.3.3", + "vite": "^5.0.11", + "vite-plugin-solid": "^2.8.2" + }, + "dependencies": { + "@fontsource/geist-sans": "^5.0.3", + "katex": "^0.16.10", + "solid-js": "^1.8.11" + } +} diff --git a/public/shortest-squares-v2.txt b/public/shortest-squares-v2.txt new file mode 100644 index 0000000..b955172 --- /dev/null +++ b/public/shortest-squares-v2.txt @@ -0,0 +1,1000 @@ +1^2 = 1 +1^2 + 1^2 = 2 +1^2 + 1^2 + 1^2 = 3 +2^2 = 4 +1^2 + 2^2 = 5 +1^2 + 1^2 + 2^2 = 6 +1^2 + 1^2 + 1^2 + 2^2 = 7 +2^2 + 2^2 = 8 +3^2 = 9 +1^2 + 3^2 = 10 +1^2 + 1^2 + 3^2 = 11 +2^2 + 2^2 + 2^2 = 12 +2^2 + 3^2 = 13 +1^2 + 2^2 + 3^2 = 14 +1^2 + 1^2 + 2^2 + 3^2 = 15 +4^2 = 16 +1^2 + 4^2 = 17 +3^2 + 3^2 = 18 +1^2 + 3^2 + 3^2 = 19 +2^2 + 4^2 = 20 +1^2 + 2^2 + 4^2 = 21 +2^2 + 3^2 + 3^2 = 22 +1^2 + 2^2 + 3^2 + 3^2 = 23 +2^2 + 2^2 + 4^2 = 24 +5^2 = 25 +1^2 + 5^2 = 26 +1^2 + 1^2 + 5^2 = 27 +1^2 + 1^2 + 1^2 + 5^2 = 28 +2^2 + 5^2 = 29 +1^2 + 2^2 + 5^2 = 30 +1^2 + 1^2 + 2^2 + 5^2 = 31 +4^2 + 4^2 = 32 +1^2 + 4^2 + 4^2 = 33 +3^2 + 5^2 = 34 +1^2 + 3^2 + 5^2 = 35 +6^2 = 36 +1^2 + 6^2 = 37 +1^2 + 1^2 + 6^2 = 38 +1^2 + 1^2 + 1^2 + 6^2 = 39 +2^2 + 6^2 = 40 +4^2 + 5^2 = 41 +1^2 + 4^2 + 5^2 = 42 +3^2 + 3^2 + 5^2 = 43 +2^2 + 2^2 + 6^2 = 44 +3^2 + 6^2 = 45 +1^2 + 3^2 + 6^2 = 46 +1^2 + 1^2 + 3^2 + 6^2 = 47 +4^2 + 4^2 + 4^2 = 48 +7^2 = 49 +1^2 + 7^2 = 50 +1^2 + 1^2 + 7^2 = 51 +4^2 + 6^2 = 52 +2^2 + 7^2 = 53 +1^2 + 2^2 + 7^2 = 54 +1^2 + 1^2 + 2^2 + 7^2 = 55 +2^2 + 4^2 + 6^2 = 56 +2^2 + 2^2 + 7^2 = 57 +3^2 + 7^2 = 58 +1^2 + 3^2 + 7^2 = 59 +1^2 + 1^2 + 3^2 + 7^2 = 60 +5^2 + 6^2 = 61 +1^2 + 5^2 + 6^2 = 62 +1^2 + 1^2 + 5^2 + 6^2 = 63 +8^2 = 64 +1^2 + 8^2 = 65 +1^2 + 1^2 + 8^2 = 66 +3^2 + 3^2 + 7^2 = 67 +2^2 + 8^2 = 68 +1^2 + 2^2 + 8^2 = 69 +3^2 + 5^2 + 6^2 = 70 +1^2 + 3^2 + 5^2 + 6^2 = 71 +6^2 + 6^2 = 72 +3^2 + 8^2 = 73 +5^2 + 7^2 = 74 +1^2 + 5^2 + 7^2 = 75 +2^2 + 6^2 + 6^2 = 76 +2^2 + 3^2 + 8^2 = 77 +2^2 + 5^2 + 7^2 = 78 +1^2 + 2^2 + 5^2 + 7^2 = 79 +4^2 + 8^2 = 80 +9^2 = 81 +1^2 + 9^2 = 82 +1^2 + 1^2 + 9^2 = 83 +2^2 + 4^2 + 8^2 = 84 +2^2 + 9^2 = 85 +1^2 + 2^2 + 9^2 = 86 +1^2 + 1^2 + 2^2 + 9^2 = 87 +4^2 + 6^2 + 6^2 = 88 +5^2 + 8^2 = 89 +3^2 + 9^2 = 90 +1^2 + 3^2 + 9^2 = 91 +1^2 + 1^2 + 3^2 + 9^2 = 92 +2^2 + 5^2 + 8^2 = 93 +2^2 + 3^2 + 9^2 = 94 +1^2 + 2^2 + 3^2 + 9^2 = 95 +4^2 + 4^2 + 8^2 = 96 +4^2 + 9^2 = 97 +7^2 + 7^2 = 98 +1^2 + 7^2 + 7^2 = 99 +10^2 = 100 +1^2 + 10^2 = 101 +1^2 + 1^2 + 10^2 = 102 +1^2 + 1^2 + 1^2 + 10^2 = 103 +2^2 + 10^2 = 104 +1^2 + 2^2 + 10^2 = 105 +5^2 + 9^2 = 106 +1^2 + 5^2 + 9^2 = 107 +2^2 + 2^2 + 10^2 = 108 +3^2 + 10^2 = 109 +1^2 + 3^2 + 10^2 = 110 +1^2 + 1^2 + 3^2 + 10^2 = 111 +2^2 + 2^2 + 2^2 + 10^2 = 112 +7^2 + 8^2 = 113 +1^2 + 7^2 + 8^2 = 114 +3^2 + 5^2 + 9^2 = 115 +4^2 + 10^2 = 116 +6^2 + 9^2 = 117 +1^2 + 6^2 + 9^2 = 118 +1^2 + 1^2 + 6^2 + 9^2 = 119 +2^2 + 4^2 + 10^2 = 120 +11^2 = 121 +1^2 + 11^2 = 122 +1^2 + 1^2 + 11^2 = 123 +1^2 + 1^2 + 1^2 + 11^2 = 124 +2^2 + 11^2 = 125 +1^2 + 2^2 + 11^2 = 126 +1^2 + 1^2 + 2^2 + 11^2 = 127 +8^2 + 8^2 = 128 +1^2 + 8^2 + 8^2 = 129 +3^2 + 11^2 = 130 +1^2 + 3^2 + 11^2 = 131 +2^2 + 8^2 + 8^2 = 132 +4^2 + 6^2 + 9^2 = 133 +2^2 + 3^2 + 11^2 = 134 +1^2 + 2^2 + 3^2 + 11^2 = 135 +6^2 + 10^2 = 136 +4^2 + 11^2 = 137 +1^2 + 4^2 + 11^2 = 138 +3^2 + 3^2 + 11^2 = 139 +2^2 + 6^2 + 10^2 = 140 +2^2 + 4^2 + 11^2 = 141 +5^2 + 6^2 + 9^2 = 142 +1^2 + 5^2 + 6^2 + 9^2 = 143 +12^2 = 144 +1^2 + 12^2 = 145 +5^2 + 11^2 = 146 +1^2 + 5^2 + 11^2 = 147 +2^2 + 12^2 = 148 +7^2 + 10^2 = 149 +1^2 + 7^2 + 10^2 = 150 +1^2 + 1^2 + 7^2 + 10^2 = 151 +2^2 + 2^2 + 12^2 = 152 +3^2 + 12^2 = 153 +1^2 + 3^2 + 12^2 = 154 +3^2 + 5^2 + 11^2 = 155 +1^2 + 3^2 + 5^2 + 11^2 = 156 +6^2 + 11^2 = 157 +1^2 + 6^2 + 11^2 = 158 +1^2 + 1^2 + 6^2 + 11^2 = 159 +4^2 + 12^2 = 160 +1^2 + 4^2 + 12^2 = 161 +9^2 + 9^2 = 162 +1^2 + 9^2 + 9^2 = 163 +8^2 + 10^2 = 164 +1^2 + 8^2 + 10^2 = 165 +2^2 + 9^2 + 9^2 = 166 +1^2 + 2^2 + 9^2 + 9^2 = 167 +2^2 + 8^2 + 10^2 = 168 +13^2 = 169 +1^2 + 13^2 = 170 +1^2 + 1^2 + 13^2 = 171 +6^2 + 6^2 + 10^2 = 172 +2^2 + 13^2 = 173 +1^2 + 2^2 + 13^2 = 174 +1^2 + 1^2 + 2^2 + 13^2 = 175 +4^2 + 4^2 + 12^2 = 176 +2^2 + 2^2 + 13^2 = 177 +3^2 + 13^2 = 178 +1^2 + 3^2 + 13^2 = 179 +6^2 + 12^2 = 180 +9^2 + 10^2 = 181 +1^2 + 9^2 + 10^2 = 182 +1^2 + 1^2 + 9^2 + 10^2 = 183 +2^2 + 6^2 + 12^2 = 184 +4^2 + 13^2 = 185 +1^2 + 4^2 + 13^2 = 186 +3^2 + 3^2 + 13^2 = 187 +1^2 + 3^2 + 3^2 + 13^2 = 188 +2^2 + 4^2 + 13^2 = 189 +3^2 + 9^2 + 10^2 = 190 +1^2 + 3^2 + 9^2 + 10^2 = 191 +8^2 + 8^2 + 8^2 = 192 +7^2 + 12^2 = 193 +5^2 + 13^2 = 194 +1^2 + 5^2 + 13^2 = 195 +14^2 = 196 +1^2 + 14^2 = 197 +1^2 + 1^2 + 14^2 = 198 +1^2 + 1^2 + 1^2 + 14^2 = 199 +2^2 + 14^2 = 200 +1^2 + 2^2 + 14^2 = 201 +9^2 + 11^2 = 202 +1^2 + 9^2 + 11^2 = 203 +2^2 + 2^2 + 14^2 = 204 +3^2 + 14^2 = 205 +1^2 + 3^2 + 14^2 = 206 +1^2 + 1^2 + 3^2 + 14^2 = 207 +8^2 + 12^2 = 208 +1^2 + 8^2 + 12^2 = 209 +4^2 + 5^2 + 13^2 = 210 +3^2 + 9^2 + 11^2 = 211 +4^2 + 14^2 = 212 +1^2 + 4^2 + 14^2 = 213 +3^2 + 3^2 + 14^2 = 214 +1^2 + 3^2 + 3^2 + 14^2 = 215 +2^2 + 4^2 + 14^2 = 216 +3^2 + 8^2 + 12^2 = 217 +7^2 + 13^2 = 218 +1^2 + 7^2 + 13^2 = 219 +1^2 + 1^2 + 7^2 + 13^2 = 220 +5^2 + 14^2 = 221 +1^2 + 5^2 + 14^2 = 222 +1^2 + 1^2 + 5^2 + 14^2 = 223 +4^2 + 8^2 + 12^2 = 224 +15^2 = 225 +1^2 + 15^2 = 226 +1^2 + 1^2 + 15^2 = 227 +4^2 + 4^2 + 14^2 = 228 +2^2 + 15^2 = 229 +1^2 + 2^2 + 15^2 = 230 +1^2 + 1^2 + 2^2 + 15^2 = 231 +6^2 + 14^2 = 232 +8^2 + 13^2 = 233 +3^2 + 15^2 = 234 +1^2 + 3^2 + 15^2 = 235 +2^2 + 6^2 + 14^2 = 236 +2^2 + 8^2 + 13^2 = 237 +2^2 + 3^2 + 15^2 = 238 +1^2 + 2^2 + 3^2 + 15^2 = 239 +2^2 + 2^2 + 6^2 + 14^2 = 240 +4^2 + 15^2 = 241 +11^2 + 11^2 = 242 +1^2 + 11^2 + 11^2 = 243 +10^2 + 12^2 = 244 +7^2 + 14^2 = 245 +1^2 + 7^2 + 14^2 = 246 +1^2 + 1^2 + 7^2 + 14^2 = 247 +2^2 + 10^2 + 12^2 = 248 +2^2 + 7^2 + 14^2 = 249 +5^2 + 15^2 = 250 +1^2 + 5^2 + 15^2 = 251 +1^2 + 1^2 + 5^2 + 15^2 = 252 +3^2 + 10^2 + 12^2 = 253 +2^2 + 5^2 + 15^2 = 254 +1^2 + 2^2 + 5^2 + 15^2 = 255 +16^2 = 256 +1^2 + 16^2 = 257 +1^2 + 1^2 + 16^2 = 258 +3^2 + 5^2 + 15^2 = 259 +2^2 + 16^2 = 260 +6^2 + 15^2 = 261 +1^2 + 6^2 + 15^2 = 262 +1^2 + 1^2 + 6^2 + 15^2 = 263 +2^2 + 2^2 + 16^2 = 264 +3^2 + 16^2 = 265 +1^2 + 3^2 + 16^2 = 266 +5^2 + 11^2 + 11^2 = 267 +6^2 + 6^2 + 14^2 = 268 +10^2 + 13^2 = 269 +1^2 + 10^2 + 13^2 = 270 +1^2 + 1^2 + 10^2 + 13^2 = 271 +4^2 + 16^2 = 272 +1^2 + 4^2 + 16^2 = 273 +7^2 + 15^2 = 274 +1^2 + 7^2 + 15^2 = 275 +2^2 + 4^2 + 16^2 = 276 +9^2 + 14^2 = 277 +1^2 + 9^2 + 14^2 = 278 +1^2 + 1^2 + 9^2 + 14^2 = 279 +6^2 + 10^2 + 12^2 = 280 +5^2 + 16^2 = 281 +1^2 + 5^2 + 16^2 = 282 +3^2 + 7^2 + 15^2 = 283 +1^2 + 3^2 + 7^2 + 15^2 = 284 +2^2 + 5^2 + 16^2 = 285 +3^2 + 9^2 + 14^2 = 286 +1^2 + 3^2 + 9^2 + 14^2 = 287 +12^2 + 12^2 = 288 +17^2 = 289 +1^2 + 17^2 = 290 +1^2 + 1^2 + 17^2 = 291 +6^2 + 16^2 = 292 +2^2 + 17^2 = 293 +1^2 + 2^2 + 17^2 = 294 +1^2 + 1^2 + 2^2 + 17^2 = 295 +10^2 + 14^2 = 296 +1^2 + 10^2 + 14^2 = 297 +3^2 + 17^2 = 298 +1^2 + 3^2 + 17^2 = 299 +2^2 + 10^2 + 14^2 = 300 +3^2 + 6^2 + 16^2 = 301 +2^2 + 3^2 + 17^2 = 302 +1^2 + 2^2 + 3^2 + 17^2 = 303 +4^2 + 12^2 + 12^2 = 304 +4^2 + 17^2 = 305 +9^2 + 15^2 = 306 +1^2 + 9^2 + 15^2 = 307 +4^2 + 6^2 + 16^2 = 308 +2^2 + 4^2 + 17^2 = 309 +2^2 + 9^2 + 15^2 = 310 +1^2 + 2^2 + 9^2 + 15^2 = 311 +4^2 + 10^2 + 14^2 = 312 +12^2 + 13^2 = 313 +5^2 + 17^2 = 314 +1^2 + 5^2 + 17^2 = 315 +1^2 + 1^2 + 5^2 + 17^2 = 316 +11^2 + 14^2 = 317 +1^2 + 11^2 + 14^2 = 318 +1^2 + 1^2 + 11^2 + 14^2 = 319 +8^2 + 16^2 = 320 +1^2 + 8^2 + 16^2 = 321 +3^2 + 12^2 + 13^2 = 322 +3^2 + 5^2 + 17^2 = 323 +18^2 = 324 +1^2 + 18^2 = 325 +1^2 + 1^2 + 18^2 = 326 +1^2 + 1^2 + 1^2 + 18^2 = 327 +2^2 + 18^2 = 328 +1^2 + 2^2 + 18^2 = 329 +4^2 + 5^2 + 17^2 = 330 +5^2 + 9^2 + 15^2 = 331 +2^2 + 2^2 + 18^2 = 332 +3^2 + 18^2 = 333 +1^2 + 3^2 + 18^2 = 334 +1^2 + 1^2 + 3^2 + 18^2 = 335 +4^2 + 8^2 + 16^2 = 336 +9^2 + 16^2 = 337 +7^2 + 17^2 = 338 +1^2 + 7^2 + 17^2 = 339 +4^2 + 18^2 = 340 +1^2 + 4^2 + 18^2 = 341 +2^2 + 7^2 + 17^2 = 342 +1^2 + 2^2 + 7^2 + 17^2 = 343 +2^2 + 4^2 + 18^2 = 344 +5^2 + 8^2 + 16^2 = 345 +11^2 + 15^2 = 346 +1^2 + 11^2 + 15^2 = 347 +1^2 + 1^2 + 11^2 + 15^2 = 348 +5^2 + 18^2 = 349 +1^2 + 5^2 + 18^2 = 350 +1^2 + 1^2 + 5^2 + 18^2 = 351 +8^2 + 12^2 + 12^2 = 352 +8^2 + 17^2 = 353 +1^2 + 8^2 + 17^2 = 354 +3^2 + 11^2 + 15^2 = 355 +10^2 + 16^2 = 356 +1^2 + 10^2 + 16^2 = 357 +3^2 + 5^2 + 18^2 = 358 +1^2 + 3^2 + 5^2 + 18^2 = 359 +6^2 + 18^2 = 360 +19^2 = 361 +1^2 + 19^2 = 362 +1^2 + 1^2 + 19^2 = 363 +2^2 + 6^2 + 18^2 = 364 +2^2 + 19^2 = 365 +1^2 + 2^2 + 19^2 = 366 +1^2 + 1^2 + 2^2 + 19^2 = 367 +2^2 + 2^2 + 6^2 + 18^2 = 368 +12^2 + 15^2 = 369 +3^2 + 19^2 = 370 +1^2 + 3^2 + 19^2 = 371 +4^2 + 10^2 + 16^2 = 372 +7^2 + 18^2 = 373 +1^2 + 7^2 + 18^2 = 374 +1^2 + 1^2 + 7^2 + 18^2 = 375 +4^2 + 6^2 + 18^2 = 376 +4^2 + 19^2 = 377 +1^2 + 4^2 + 19^2 = 378 +3^2 + 3^2 + 19^2 = 379 +1^2 + 3^2 + 3^2 + 19^2 = 380 +2^2 + 4^2 + 19^2 = 381 +3^2 + 7^2 + 18^2 = 382 +1^2 + 3^2 + 7^2 + 18^2 = 383 +8^2 + 8^2 + 16^2 = 384 +4^2 + 12^2 + 15^2 = 385 +5^2 + 19^2 = 386 +1^2 + 5^2 + 19^2 = 387 +8^2 + 18^2 = 388 +10^2 + 17^2 = 389 +1^2 + 10^2 + 17^2 = 390 +1^2 + 1^2 + 10^2 + 17^2 = 391 +14^2 + 14^2 = 392 +1^2 + 14^2 + 14^2 = 393 +13^2 + 15^2 = 394 +1^2 + 13^2 + 15^2 = 395 +2^2 + 14^2 + 14^2 = 396 +6^2 + 19^2 = 397 +1^2 + 6^2 + 19^2 = 398 +1^2 + 1^2 + 6^2 + 19^2 = 399 +20^2 = 400 +1^2 + 20^2 = 401 +1^2 + 1^2 + 20^2 = 402 +3^2 + 13^2 + 15^2 = 403 +2^2 + 20^2 = 404 +9^2 + 18^2 = 405 +1^2 + 9^2 + 18^2 = 406 +1^2 + 1^2 + 9^2 + 18^2 = 407 +2^2 + 2^2 + 20^2 = 408 +3^2 + 20^2 = 409 +7^2 + 19^2 = 410 +1^2 + 7^2 + 19^2 = 411 +1^2 + 1^2 + 7^2 + 19^2 = 412 +2^2 + 3^2 + 20^2 = 413 +2^2 + 7^2 + 19^2 = 414 +1^2 + 2^2 + 7^2 + 19^2 = 415 +4^2 + 20^2 = 416 +1^2 + 4^2 + 20^2 = 417 +3^2 + 3^2 + 20^2 = 418 +3^2 + 7^2 + 19^2 = 419 +2^2 + 4^2 + 20^2 = 420 +14^2 + 15^2 = 421 +1^2 + 14^2 + 15^2 = 422 +1^2 + 1^2 + 14^2 + 15^2 = 423 +10^2 + 18^2 = 424 +5^2 + 20^2 = 425 +1^2 + 5^2 + 20^2 = 426 +9^2 + 11^2 + 15^2 = 427 +2^2 + 10^2 + 18^2 = 428 +2^2 + 5^2 + 20^2 = 429 +3^2 + 14^2 + 15^2 = 430 +1^2 + 3^2 + 14^2 + 15^2 = 431 +4^2 + 4^2 + 20^2 = 432 +12^2 + 17^2 = 433 +1^2 + 12^2 + 17^2 = 434 +5^2 + 7^2 + 19^2 = 435 +6^2 + 20^2 = 436 +1^2 + 6^2 + 20^2 = 437 +7^2 + 10^2 + 17^2 = 438 +1^2 + 7^2 + 10^2 + 17^2 = 439 +2^2 + 6^2 + 20^2 = 440 +21^2 = 441 +1^2 + 21^2 = 442 +1^2 + 1^2 + 21^2 = 443 +1^2 + 1^2 + 1^2 + 21^2 = 444 +2^2 + 21^2 = 445 +1^2 + 2^2 + 21^2 = 446 +1^2 + 1^2 + 2^2 + 21^2 = 447 +4^2 + 4^2 + 4^2 + 20^2 = 448 +7^2 + 20^2 = 449 +3^2 + 21^2 = 450 +1^2 + 3^2 + 21^2 = 451 +14^2 + 16^2 = 452 +1^2 + 14^2 + 16^2 = 453 +2^2 + 3^2 + 21^2 = 454 +1^2 + 2^2 + 3^2 + 21^2 = 455 +2^2 + 14^2 + 16^2 = 456 +4^2 + 21^2 = 457 +13^2 + 17^2 = 458 +1^2 + 13^2 + 17^2 = 459 +6^2 + 10^2 + 18^2 = 460 +10^2 + 19^2 = 461 +1^2 + 10^2 + 19^2 = 462 +1^2 + 1^2 + 10^2 + 19^2 = 463 +8^2 + 20^2 = 464 +1^2 + 8^2 + 20^2 = 465 +5^2 + 21^2 = 466 +1^2 + 5^2 + 21^2 = 467 +12^2 + 18^2 = 468 +1^2 + 12^2 + 18^2 = 469 +2^2 + 5^2 + 21^2 = 470 +1^2 + 2^2 + 5^2 + 21^2 = 471 +2^2 + 12^2 + 18^2 = 472 +3^2 + 8^2 + 20^2 = 473 +4^2 + 13^2 + 17^2 = 474 +3^2 + 5^2 + 21^2 = 475 +1^2 + 3^2 + 5^2 + 21^2 = 476 +6^2 + 21^2 = 477 +1^2 + 6^2 + 21^2 = 478 +1^2 + 1^2 + 6^2 + 21^2 = 479 +4^2 + 8^2 + 20^2 = 480 +9^2 + 20^2 = 481 +11^2 + 19^2 = 482 +1^2 + 11^2 + 19^2 = 483 +22^2 = 484 +1^2 + 22^2 = 485 +1^2 + 1^2 + 22^2 = 486 +1^2 + 1^2 + 1^2 + 22^2 = 487 +2^2 + 22^2 = 488 +1^2 + 2^2 + 22^2 = 489 +7^2 + 21^2 = 490 +1^2 + 7^2 + 21^2 = 491 +2^2 + 2^2 + 22^2 = 492 +3^2 + 22^2 = 493 +1^2 + 3^2 + 22^2 = 494 +1^2 + 1^2 + 3^2 + 22^2 = 495 +2^2 + 2^2 + 2^2 + 22^2 = 496 +2^2 + 3^2 + 22^2 = 497 +4^2 + 11^2 + 19^2 = 498 +3^2 + 7^2 + 21^2 = 499 +4^2 + 22^2 = 500 +1^2 + 4^2 + 22^2 = 501 +3^2 + 3^2 + 22^2 = 502 +1^2 + 3^2 + 3^2 + 22^2 = 503 +2^2 + 4^2 + 22^2 = 504 +8^2 + 21^2 = 505 +1^2 + 8^2 + 21^2 = 506 +5^2 + 11^2 + 19^2 = 507 +1^2 + 5^2 + 11^2 + 19^2 = 508 +5^2 + 22^2 = 509 +1^2 + 5^2 + 22^2 = 510 +1^2 + 1^2 + 5^2 + 22^2 = 511 +16^2 + 16^2 = 512 +1^2 + 16^2 + 16^2 = 513 +15^2 + 17^2 = 514 +1^2 + 15^2 + 17^2 = 515 +2^2 + 16^2 + 16^2 = 516 +6^2 + 9^2 + 20^2 = 517 +2^2 + 15^2 + 17^2 = 518 +1^2 + 2^2 + 15^2 + 17^2 = 519 +6^2 + 22^2 = 520 +11^2 + 20^2 = 521 +9^2 + 21^2 = 522 +1^2 + 9^2 + 21^2 = 523 +2^2 + 6^2 + 22^2 = 524 +2^2 + 11^2 + 20^2 = 525 +2^2 + 9^2 + 21^2 = 526 +1^2 + 2^2 + 9^2 + 21^2 = 527 +4^2 + 16^2 + 16^2 = 528 +23^2 = 529 +1^2 + 23^2 = 530 +1^2 + 1^2 + 23^2 = 531 +8^2 + 12^2 + 18^2 = 532 +2^2 + 23^2 = 533 +1^2 + 2^2 + 23^2 = 534 +1^2 + 1^2 + 2^2 + 23^2 = 535 +4^2 + 6^2 + 22^2 = 536 +2^2 + 2^2 + 23^2 = 537 +3^2 + 23^2 = 538 +1^2 + 3^2 + 23^2 = 539 +1^2 + 1^2 + 3^2 + 23^2 = 540 +10^2 + 21^2 = 541 +1^2 + 10^2 + 21^2 = 542 +1^2 + 1^2 + 10^2 + 21^2 = 543 +12^2 + 20^2 = 544 +4^2 + 23^2 = 545 +1^2 + 4^2 + 23^2 = 546 +3^2 + 3^2 + 23^2 = 547 +8^2 + 22^2 = 548 +15^2 + 18^2 = 549 +1^2 + 15^2 + 18^2 = 550 +1^2 + 1^2 + 15^2 + 18^2 = 551 +2^2 + 8^2 + 22^2 = 552 +2^2 + 15^2 + 18^2 = 553 +5^2 + 23^2 = 554 +1^2 + 5^2 + 23^2 = 555 +6^2 + 6^2 + 22^2 = 556 +14^2 + 19^2 = 557 +1^2 + 14^2 + 19^2 = 558 +1^2 + 1^2 + 14^2 + 19^2 = 559 +4^2 + 12^2 + 20^2 = 560 +2^2 + 14^2 + 19^2 = 561 +11^2 + 21^2 = 562 +1^2 + 11^2 + 21^2 = 563 +4^2 + 8^2 + 22^2 = 564 +6^2 + 23^2 = 565 +1^2 + 6^2 + 23^2 = 566 +1^2 + 1^2 + 6^2 + 23^2 = 567 +10^2 + 12^2 + 18^2 = 568 +13^2 + 20^2 = 569 +1^2 + 13^2 + 20^2 = 570 +3^2 + 11^2 + 21^2 = 571 +1^2 + 3^2 + 11^2 + 21^2 = 572 +2^2 + 13^2 + 20^2 = 573 +3^2 + 6^2 + 23^2 = 574 +1^2 + 3^2 + 6^2 + 23^2 = 575 +24^2 = 576 +1^2 + 24^2 = 577 +7^2 + 23^2 = 578 +1^2 + 7^2 + 23^2 = 579 +2^2 + 24^2 = 580 +1^2 + 2^2 + 24^2 = 581 +2^2 + 7^2 + 23^2 = 582 +1^2 + 2^2 + 7^2 + 23^2 = 583 +10^2 + 22^2 = 584 +3^2 + 24^2 = 585 +15^2 + 19^2 = 586 +1^2 + 15^2 + 19^2 = 587 +2^2 + 10^2 + 22^2 = 588 +2^2 + 3^2 + 24^2 = 589 +2^2 + 15^2 + 19^2 = 590 +1^2 + 2^2 + 15^2 + 19^2 = 591 +4^2 + 24^2 = 592 +8^2 + 23^2 = 593 +1^2 + 8^2 + 23^2 = 594 +3^2 + 15^2 + 19^2 = 595 +14^2 + 20^2 = 596 +1^2 + 14^2 + 20^2 = 597 +6^2 + 11^2 + 21^2 = 598 +1^2 + 6^2 + 11^2 + 21^2 = 599 +2^2 + 14^2 + 20^2 = 600 +5^2 + 24^2 = 601 +1^2 + 5^2 + 24^2 = 602 +5^2 + 7^2 + 23^2 = 603 +1^2 + 5^2 + 7^2 + 23^2 = 604 +11^2 + 22^2 = 605 +1^2 + 11^2 + 22^2 = 606 +1^2 + 1^2 + 11^2 + 22^2 = 607 +4^2 + 4^2 + 24^2 = 608 +2^2 + 11^2 + 22^2 = 609 +9^2 + 23^2 = 610 +1^2 + 9^2 + 23^2 = 611 +6^2 + 24^2 = 612 +17^2 + 18^2 = 613 +1^2 + 17^2 + 18^2 = 614 +1^2 + 1^2 + 17^2 + 18^2 = 615 +2^2 + 6^2 + 24^2 = 616 +16^2 + 19^2 = 617 +1^2 + 16^2 + 19^2 = 618 +3^2 + 9^2 + 23^2 = 619 +6^2 + 10^2 + 22^2 = 620 +2^2 + 16^2 + 19^2 = 621 +3^2 + 17^2 + 18^2 = 622 +1^2 + 3^2 + 17^2 + 18^2 = 623 +2^2 + 6^2 + 10^2 + 22^2 = 624 +25^2 = 625 +1^2 + 25^2 = 626 +1^2 + 1^2 + 25^2 = 627 +12^2 + 22^2 = 628 +2^2 + 25^2 = 629 +1^2 + 2^2 + 25^2 = 630 +1^2 + 1^2 + 2^2 + 25^2 = 631 +2^2 + 12^2 + 22^2 = 632 +2^2 + 2^2 + 25^2 = 633 +3^2 + 25^2 = 634 +1^2 + 3^2 + 25^2 = 635 +1^2 + 1^2 + 3^2 + 25^2 = 636 +14^2 + 21^2 = 637 +1^2 + 14^2 + 21^2 = 638 +1^2 + 1^2 + 14^2 + 21^2 = 639 +8^2 + 24^2 = 640 +4^2 + 25^2 = 641 +1^2 + 4^2 + 25^2 = 642 +3^2 + 3^2 + 25^2 = 643 +2^2 + 8^2 + 24^2 = 644 +2^2 + 4^2 + 25^2 = 645 +3^2 + 14^2 + 21^2 = 646 +1^2 + 3^2 + 14^2 + 21^2 = 647 +18^2 + 18^2 = 648 +1^2 + 18^2 + 18^2 = 649 +5^2 + 25^2 = 650 +1^2 + 5^2 + 25^2 = 651 +2^2 + 18^2 + 18^2 = 652 +13^2 + 22^2 = 653 +1^2 + 13^2 + 22^2 = 654 +1^2 + 1^2 + 13^2 + 22^2 = 655 +16^2 + 20^2 = 656 +9^2 + 24^2 = 657 +1^2 + 9^2 + 24^2 = 658 +3^2 + 5^2 + 25^2 = 659 +2^2 + 16^2 + 20^2 = 660 +6^2 + 25^2 = 661 +1^2 + 6^2 + 25^2 = 662 +1^2 + 1^2 + 6^2 + 25^2 = 663 +4^2 + 18^2 + 18^2 = 664 +2^2 + 6^2 + 25^2 = 665 +15^2 + 21^2 = 666 +1^2 + 15^2 + 21^2 = 667 +1^2 + 1^2 + 15^2 + 21^2 = 668 +4^2 + 13^2 + 22^2 = 669 +2^2 + 15^2 + 21^2 = 670 +1^2 + 2^2 + 15^2 + 21^2 = 671 +4^2 + 16^2 + 20^2 = 672 +12^2 + 23^2 = 673 +7^2 + 25^2 = 674 +1^2 + 7^2 + 25^2 = 675 +26^2 = 676 +1^2 + 26^2 = 677 +1^2 + 1^2 + 26^2 = 678 +1^2 + 1^2 + 1^2 + 26^2 = 679 +2^2 + 26^2 = 680 +1^2 + 2^2 + 26^2 = 681 +3^2 + 12^2 + 23^2 = 682 +3^2 + 7^2 + 25^2 = 683 +2^2 + 2^2 + 26^2 = 684 +3^2 + 26^2 = 685 +1^2 + 3^2 + 26^2 = 686 +1^2 + 1^2 + 3^2 + 26^2 = 687 +12^2 + 12^2 + 20^2 = 688 +8^2 + 25^2 = 689 +1^2 + 8^2 + 25^2 = 690 +5^2 + 15^2 + 21^2 = 691 +4^2 + 26^2 = 692 +1^2 + 4^2 + 26^2 = 693 +3^2 + 3^2 + 26^2 = 694 +1^2 + 3^2 + 3^2 + 26^2 = 695 +2^2 + 4^2 + 26^2 = 696 +11^2 + 24^2 = 697 +13^2 + 23^2 = 698 +1^2 + 13^2 + 23^2 = 699 +1^2 + 1^2 + 13^2 + 23^2 = 700 +5^2 + 26^2 = 701 +1^2 + 5^2 + 26^2 = 702 +1^2 + 1^2 + 5^2 + 26^2 = 703 +8^2 + 8^2 + 24^2 = 704 +2^2 + 5^2 + 26^2 = 705 +9^2 + 25^2 = 706 +1^2 + 9^2 + 25^2 = 707 +4^2 + 4^2 + 26^2 = 708 +15^2 + 22^2 = 709 +1^2 + 15^2 + 22^2 = 710 +1^2 + 1^2 + 15^2 + 22^2 = 711 +6^2 + 26^2 = 712 +1^2 + 6^2 + 26^2 = 713 +4^2 + 13^2 + 23^2 = 714 +3^2 + 9^2 + 25^2 = 715 +2^2 + 6^2 + 26^2 = 716 +4^2 + 5^2 + 26^2 = 717 +3^2 + 15^2 + 22^2 = 718 +1^2 + 3^2 + 15^2 + 22^2 = 719 +12^2 + 24^2 = 720 +1^2 + 12^2 + 24^2 = 721 +19^2 + 19^2 = 722 +1^2 + 19^2 + 19^2 = 723 +18^2 + 20^2 = 724 +7^2 + 26^2 = 725 +1^2 + 7^2 + 26^2 = 726 +1^2 + 1^2 + 7^2 + 26^2 = 727 +2^2 + 18^2 + 20^2 = 728 +27^2 = 729 +1^2 + 27^2 = 730 +1^2 + 1^2 + 27^2 = 731 +1^2 + 1^2 + 1^2 + 27^2 = 732 +2^2 + 27^2 = 733 +1^2 + 2^2 + 27^2 = 734 +1^2 + 1^2 + 2^2 + 27^2 = 735 +4^2 + 12^2 + 24^2 = 736 +2^2 + 2^2 + 27^2 = 737 +3^2 + 27^2 = 738 +1^2 + 3^2 + 27^2 = 739 +8^2 + 26^2 = 740 +1^2 + 8^2 + 26^2 = 741 +2^2 + 3^2 + 27^2 = 742 +1^2 + 2^2 + 3^2 + 27^2 = 743 +2^2 + 8^2 + 26^2 = 744 +4^2 + 27^2 = 745 +11^2 + 25^2 = 746 +1^2 + 11^2 + 25^2 = 747 +6^2 + 6^2 + 26^2 = 748 +2^2 + 4^2 + 27^2 = 749 +2^2 + 11^2 + 25^2 = 750 +1^2 + 2^2 + 11^2 + 25^2 = 751 +2^2 + 6^2 + 6^2 + 26^2 = 752 +8^2 + 8^2 + 25^2 = 753 +5^2 + 27^2 = 754 +1^2 + 5^2 + 27^2 = 755 +4^2 + 8^2 + 26^2 = 756 +9^2 + 26^2 = 757 +1^2 + 9^2 + 26^2 = 758 +1^2 + 1^2 + 9^2 + 26^2 = 759 +6^2 + 18^2 + 20^2 = 760 +19^2 + 20^2 = 761 +1^2 + 19^2 + 20^2 = 762 +3^2 + 5^2 + 27^2 = 763 +1^2 + 3^2 + 5^2 + 27^2 = 764 +6^2 + 27^2 = 765 +1^2 + 6^2 + 27^2 = 766 +1^2 + 1^2 + 6^2 + 27^2 = 767 +16^2 + 16^2 + 16^2 = 768 +12^2 + 25^2 = 769 +1^2 + 12^2 + 25^2 = 770 +5^2 + 11^2 + 25^2 = 771 +14^2 + 24^2 = 772 +17^2 + 22^2 = 773 +1^2 + 17^2 + 22^2 = 774 +1^2 + 1^2 + 17^2 + 22^2 = 775 +10^2 + 26^2 = 776 +1^2 + 10^2 + 26^2 = 777 +7^2 + 27^2 = 778 +1^2 + 7^2 + 27^2 = 779 +2^2 + 10^2 + 26^2 = 780 +3^2 + 14^2 + 24^2 = 781 +2^2 + 7^2 + 27^2 = 782 +1^2 + 2^2 + 7^2 + 27^2 = 783 +28^2 = 784 +1^2 + 28^2 = 785 +1^2 + 1^2 + 28^2 = 786 +3^2 + 7^2 + 27^2 = 787 +2^2 + 28^2 = 788 +1^2 + 2^2 + 28^2 = 789 +5^2 + 6^2 + 27^2 = 790 +1^2 + 5^2 + 6^2 + 27^2 = 791 +2^2 + 2^2 + 28^2 = 792 +3^2 + 28^2 = 793 +13^2 + 25^2 = 794 +1^2 + 13^2 + 25^2 = 795 +1^2 + 1^2 + 13^2 + 25^2 = 796 +11^2 + 26^2 = 797 +1^2 + 11^2 + 26^2 = 798 +1^2 + 1^2 + 11^2 + 26^2 = 799 +4^2 + 28^2 = 800 +15^2 + 24^2 = 801 +19^2 + 21^2 = 802 +1^2 + 19^2 + 21^2 = 803 +2^2 + 4^2 + 28^2 = 804 +2^2 + 15^2 + 24^2 = 805 +2^2 + 19^2 + 21^2 = 806 +1^2 + 2^2 + 19^2 + 21^2 = 807 +18^2 + 22^2 = 808 +5^2 + 28^2 = 809 +9^2 + 27^2 = 810 +1^2 + 9^2 + 27^2 = 811 +2^2 + 18^2 + 22^2 = 812 +2^2 + 5^2 + 28^2 = 813 +2^2 + 9^2 + 27^2 = 814 +1^2 + 2^2 + 9^2 + 27^2 = 815 +4^2 + 4^2 + 28^2 = 816 +3^2 + 18^2 + 22^2 = 817 +17^2 + 23^2 = 818 +1^2 + 17^2 + 23^2 = 819 +6^2 + 28^2 = 820 +14^2 + 25^2 = 821 +1^2 + 14^2 + 25^2 = 822 +1^2 + 1^2 + 14^2 + 25^2 = 823 +2^2 + 6^2 + 28^2 = 824 +2^2 + 14^2 + 25^2 = 825 +4^2 + 9^2 + 27^2 = 826 +3^2 + 17^2 + 23^2 = 827 +1^2 + 3^2 + 17^2 + 23^2 = 828 +10^2 + 27^2 = 829 +1^2 + 10^2 + 27^2 = 830 +1^2 + 1^2 + 10^2 + 27^2 = 831 +16^2 + 24^2 = 832 +7^2 + 28^2 = 833 +1^2 + 7^2 + 28^2 = 834 +5^2 + 9^2 + 27^2 = 835 +2^2 + 16^2 + 24^2 = 836 +2^2 + 7^2 + 28^2 = 837 +3^2 + 10^2 + 27^2 = 838 +1^2 + 3^2 + 10^2 + 27^2 = 839 +8^2 + 10^2 + 26^2 = 840 +29^2 = 841 +1^2 + 29^2 = 842 +1^2 + 1^2 + 29^2 = 843 +6^2 + 18^2 + 22^2 = 844 +2^2 + 29^2 = 845 +1^2 + 2^2 + 29^2 = 846 +1^2 + 1^2 + 2^2 + 29^2 = 847 +8^2 + 28^2 = 848 +1^2 + 8^2 + 28^2 = 849 +3^2 + 29^2 = 850 +1^2 + 3^2 + 29^2 = 851 +2^2 + 8^2 + 28^2 = 852 +18^2 + 23^2 = 853 +1^2 + 18^2 + 23^2 = 854 +1^2 + 1^2 + 18^2 + 23^2 = 855 +6^2 + 6^2 + 28^2 = 856 +4^2 + 29^2 = 857 +1^2 + 4^2 + 29^2 = 858 +3^2 + 3^2 + 29^2 = 859 +1^2 + 3^2 + 3^2 + 29^2 = 860 +2^2 + 4^2 + 29^2 = 861 +3^2 + 18^2 + 23^2 = 862 +1^2 + 3^2 + 18^2 + 23^2 = 863 +4^2 + 8^2 + 28^2 = 864 +9^2 + 28^2 = 865 +5^2 + 29^2 = 866 +1^2 + 5^2 + 29^2 = 867 +6^2 + 16^2 + 24^2 = 868 +2^2 + 9^2 + 28^2 = 869 +2^2 + 5^2 + 29^2 = 870 +1^2 + 2^2 + 5^2 + 29^2 = 871 +14^2 + 26^2 = 872 +12^2 + 27^2 = 873 +1^2 + 12^2 + 27^2 = 874 +3^2 + 5^2 + 29^2 = 875 +2^2 + 14^2 + 26^2 = 876 +6^2 + 29^2 = 877 +1^2 + 6^2 + 29^2 = 878 +1^2 + 1^2 + 6^2 + 29^2 = 879 +2^2 + 2^2 + 14^2 + 26^2 = 880 +16^2 + 25^2 = 881 +21^2 + 21^2 = 882 +1^2 + 21^2 + 21^2 = 883 +10^2 + 28^2 = 884 +1^2 + 10^2 + 28^2 = 885 +2^2 + 21^2 + 21^2 = 886 +1^2 + 2^2 + 21^2 + 21^2 = 887 +2^2 + 10^2 + 28^2 = 888 +4^2 + 12^2 + 27^2 = 889 +7^2 + 29^2 = 890 +1^2 + 7^2 + 29^2 = 891 +1^2 + 1^2 + 7^2 + 29^2 = 892 +3^2 + 10^2 + 28^2 = 893 +2^2 + 7^2 + 29^2 = 894 +1^2 + 2^2 + 7^2 + 29^2 = 895 +8^2 + 16^2 + 24^2 = 896 +4^2 + 16^2 + 25^2 = 897 +13^2 + 27^2 = 898 +1^2 + 13^2 + 27^2 = 899 +30^2 = 900 +1^2 + 30^2 = 901 +1^2 + 1^2 + 30^2 = 902 +1^2 + 1^2 + 1^2 + 30^2 = 903 +2^2 + 30^2 = 904 +8^2 + 29^2 = 905 +1^2 + 8^2 + 29^2 = 906 +3^2 + 13^2 + 27^2 = 907 +2^2 + 2^2 + 30^2 = 908 +3^2 + 30^2 = 909 +1^2 + 3^2 + 30^2 = 910 +1^2 + 1^2 + 3^2 + 30^2 = 911 +8^2 + 8^2 + 28^2 = 912 +2^2 + 3^2 + 30^2 = 913 +17^2 + 25^2 = 914 +1^2 + 17^2 + 25^2 = 915 +4^2 + 30^2 = 916 +1^2 + 4^2 + 30^2 = 917 +2^2 + 17^2 + 25^2 = 918 +1^2 + 2^2 + 17^2 + 25^2 = 919 +2^2 + 4^2 + 30^2 = 920 +4^2 + 8^2 + 29^2 = 921 +9^2 + 29^2 = 922 +1^2 + 9^2 + 29^2 = 923 +1^2 + 1^2 + 9^2 + 29^2 = 924 +5^2 + 30^2 = 925 +1^2 + 5^2 + 30^2 = 926 +1^2 + 1^2 + 5^2 + 30^2 = 927 +12^2 + 28^2 = 928 +20^2 + 23^2 = 929 +1^2 + 20^2 + 23^2 = 930 +3^2 + 9^2 + 29^2 = 931 +16^2 + 26^2 = 932 +1^2 + 16^2 + 26^2 = 933 +3^2 + 5^2 + 30^2 = 934 +1^2 + 3^2 + 5^2 + 30^2 = 935 +6^2 + 30^2 = 936 +19^2 + 24^2 = 937 +1^2 + 19^2 + 24^2 = 938 +5^2 + 17^2 + 25^2 = 939 +2^2 + 6^2 + 30^2 = 940 +10^2 + 29^2 = 941 +1^2 + 10^2 + 29^2 = 942 +1^2 + 1^2 + 10^2 + 29^2 = 943 +4^2 + 12^2 + 28^2 = 944 +2^2 + 10^2 + 29^2 = 945 +3^2 + 19^2 + 24^2 = 946 +5^2 + 9^2 + 29^2 = 947 +4^2 + 16^2 + 26^2 = 948 +7^2 + 30^2 = 949 +1^2 + 7^2 + 30^2 = 950 +1^2 + 1^2 + 7^2 + 30^2 = 951 +4^2 + 6^2 + 30^2 = 952 +13^2 + 28^2 = 953 +15^2 + 27^2 = 954 +1^2 + 15^2 + 27^2 = 955 +1^2 + 1^2 + 15^2 + 27^2 = 956 +2^2 + 13^2 + 28^2 = 957 +2^2 + 15^2 + 27^2 = 958 +1^2 + 2^2 + 15^2 + 27^2 = 959 +4^2 + 4^2 + 12^2 + 28^2 = 960 +31^2 = 961 +1^2 + 31^2 = 962 +1^2 + 1^2 + 31^2 = 963 +8^2 + 30^2 = 964 +2^2 + 31^2 = 965 +1^2 + 2^2 + 31^2 = 966 +1^2 + 1^2 + 2^2 + 31^2 = 967 +22^2 + 22^2 = 968 +1^2 + 22^2 + 22^2 = 969 +3^2 + 31^2 = 970 +1^2 + 3^2 + 31^2 = 971 +2^2 + 22^2 + 22^2 = 972 +3^2 + 8^2 + 30^2 = 973 +2^2 + 3^2 + 31^2 = 974 +1^2 + 2^2 + 3^2 + 31^2 = 975 +20^2 + 24^2 = 976 +4^2 + 31^2 = 977 +1^2 + 4^2 + 31^2 = 978 +3^2 + 3^2 + 31^2 = 979 +14^2 + 28^2 = 980 +9^2 + 30^2 = 981 +1^2 + 9^2 + 30^2 = 982 +1^2 + 1^2 + 9^2 + 30^2 = 983 +2^2 + 14^2 + 28^2 = 984 +12^2 + 29^2 = 985 +5^2 + 31^2 = 986 +1^2 + 5^2 + 31^2 = 987 +1^2 + 1^2 + 5^2 + 31^2 = 988 +2^2 + 12^2 + 29^2 = 989 +2^2 + 5^2 + 31^2 = 990 +1^2 + 2^2 + 5^2 + 31^2 = 991 +4^2 + 20^2 + 24^2 = 992 +4^2 + 4^2 + 31^2 = 993 +3^2 + 12^2 + 29^2 = 994 +3^2 + 5^2 + 31^2 = 995 +4^2 + 14^2 + 28^2 = 996 +6^2 + 31^2 = 997 +1^2 + 6^2 + 31^2 = 998 +1^2 + 1^2 + 6^2 + 31^2 = 999 +10^2 + 30^2 = 1000 diff --git a/src/main.jsx b/src/main.jsx new file mode 100644 index 0000000..8723a09 --- /dev/null +++ b/src/main.jsx @@ -0,0 +1,94 @@ +import '@fontsource/geist-sans/latin.css' +import 'katex/dist/katex.min.css' + +import katex from 'katex' + +import './styles.css' + +import { For, Show, createEffect, createMemo, createResource, createSignal } from 'solid-js' +import { render } from 'solid-js/web' + +const LaTeX = ({ content }) => katex.render(content, el)} /> + +const generateScript = (value, expression) => { + const vector = expression.split('+').map(part => part.split('^')[0].trim()) + + return ` +# cambia queste due righe con i valori corretti +file="my-file.pdf" +sides="two-sided-long-edge" # otherwise use two-sided-short-edge or one-sided + +# stampa ${value} = ${expression} copie +for sq in ${vector.join(' ')}; do + lpr -P cdclf -# $sq -o media=a4 -o fit-to-page -o sides=$sides $file +done` // <- this missing "\n" is intentional +} // <- this missing "\n" is intentional + +const ResultItem = ({ value, expression }) => { + const handleClick = () => { + navigator.clipboard.writeText(generateScript(value, expression)) + } + + return ( +
+ +
+ ) +} + +const App = ({}) => { + const [rawData] = createResource(() => fetch('/shortest-squares-v2.txt').then(res => res.text())) + const dict = createMemo(() => + Object.fromEntries( + (rawData() ?? '') + .split('\n') + .filter(Boolean) + .map(line => { + const [expression, value] = line.split('=').map(part => part.trim()) + return [parseInt(value), expression] + }) + ) + ) + + createEffect(() => { + console.log('dict', dict()) + }) + + const [text, setText] = createSignal('') + + const results = createMemo(() => { + const entries = Object.entries(dict()) + const query = text().trim() + + if (query === '') return entries + + if (!/^\d+$/.test(query)) return entries + + return entries.filter(([value]) => value.toString().includes(query)) + }) + + const SHOW_COUNT = 8 + + return ( + <> +

Shortest Sum of Squares

+

+ Click a sum of squares to copy the lpr shell command to print that number of copies +

+ setText(e.target.value)} /> +
SHOW_COUNT }}> + + {([value, expression]) => } + + +

+ For now we pre-computed the shortest sums of squares up to 1000 as you shouldn't need to print more than + that many copies of a document. Paper is a precious resource after all. +

+
+
+ + ) +} + +render(() => , document.getElementById('app')) diff --git a/src/styles.css b/src/styles.css new file mode 100644 index 0000000..eee4f91 --- /dev/null +++ b/src/styles.css @@ -0,0 +1,169 @@ +*, +*::before, +*::after { + font-family: inherit; + margin: 0; + padding: 0; + box-sizing: border-box; +} + +html, +body { + width: 100%; + height: 100%; + min-height: 100%; +} + +img { + display: block; +} + +body { + padding: 4rem 0; + + font-family: 'Geist Sans', sans-serif; + font-size: 16px; + line-height: 1.5; + + color: #333; + + display: grid; + justify-content: center; + + @media screen and (max-width: 768px) { + padding: 1rem 0.5rem; + } +} + +/* Components */ + +h1, +h2, +h3, +h4 { + font-weight: 500; +} + +h1 { + font-size: 3rem; + text-wrap: balance; + text-align: center; + line-height: 1.25; +} + +p { + font-size: 18px; + font-weight: 400; + + max-width: 60ch; + text-align: center; +} + +pre, code { + font-family: 'Fira Code', 'Menlo', monospace; +} + +code { + font-size: 95%; +} + +input[type='text'] { + height: 2.5rem; + + padding: 0 1rem; + border: 1px solid #ddd; + background: #fff; + border-radius: 5rem; + outline: none; + + font-size: 18px; + + text-align: center; + + &:hover:not(:focus) { + border: 1px solid #aaa; + } +} + +.has-more { + position: relative; + + &::after { + content: ''; + position: absolute; + bottom: 0; + width: 100%; + height: 5rem; + + pointer-events: none; + + z-index: 10; + + background: linear-gradient(0deg, #ffffff, #ffffff00); + } +} + +/* Structure */ + +#app { + display: flex; + flex-direction: column; + + align-items: center; + + gap: 2rem; + + max-width: 100%; + + & > input { + width: 100%; + max-width: 30rem; + + box-shadow: 0 0 15rem #00000018; + } + + .results { + display: flex; + flex-direction: column; + align-items: center; + + user-select: none; + + gap: 0.25rem; + + text-align: center; + + & > .result-item { + cursor: pointer; + + display: grid; + place-content: center; + + padding: 0.25rem 0.5rem; + border-radius: 0.5rem; + + &:nth-child(1) { + font-size: 28px; + } + + + &:hover { + background: #f2f2f2; + } + + @media screen and (max-width: 768px) { + &:nth-child(1) { + font-size: 24px; + } + + &:not(:nth-child(1)) { + font-size: 16px; + } + } + } + } + + @media screen and (max-width: 768px) { + gap: 1rem; + } +} diff --git a/tsconfig.json b/tsconfig.json new file mode 100644 index 0000000..2f5db95 --- /dev/null +++ b/tsconfig.json @@ -0,0 +1,30 @@ +{ + "compilerOptions": { + // Enable latest features + "lib": ["ESNext", "DOM"], + "target": "ESNext", + "module": "ESNext", + "moduleDetection": "force", + "allowJs": true, + + // Bundler mode + "moduleResolution": "bundler", + "allowImportingTsExtensions": true, + "verbatimModuleSyntax": true, + "noEmit": true, + + // Best practices + "strict": true, + "skipLibCheck": true, + "noFallthroughCasesInSwitch": true, + + // Some stricter flags (disabled by default) + "noUnusedLocals": false, + "noUnusedParameters": false, + "noPropertyAccessFromIndexSignature": false, + + // JSX + "jsx": "preserve", + "jsxImportSource": "solid-js" + } +} diff --git a/vite.config.js b/vite.config.js new file mode 100644 index 0000000..740f6f7 --- /dev/null +++ b/vite.config.js @@ -0,0 +1,16 @@ +import { defineConfig } from 'vite' +import solidPlugin from 'vite-plugin-solid' +// import devtools from 'solid-devtools/vite'; + +export default defineConfig({ + plugins: [ + // devtools(), + solidPlugin(), + ], + server: { + port: 3000, + }, + build: { + target: 'esnext', + }, +})