-
Notifications
You must be signed in to change notification settings - Fork 39
/
FCUBES.HTM
572 lines (572 loc) · 41 KB
/
FCUBES.HTM
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
<!doctype html>
<html lang="en" prefix="og: http://ogp.me/ns# article: http://ogp.me/ns/article#">
<head>
<meta charset="utf-8">
<meta name="Author" content="Dario Alejandro Alpern">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<meta name="keywords" content="waring, number theory">
<meta name="description" content="Web application that finds the decomposition of a number into cubes. Written by Dario Alpern.">
<meta name="theme-color" content="#db5945">
<meta name="twitter:card" content="summary_large_image">
<meta property="og:title" content="Sum of four cubes">
<meta property="og:type" content="article">
<meta property="og:site_name" content="Alpertron">
<meta property="og:url" content="https://www.alpertron.com.ar/FCUBES.HTM">
<meta property="og:image" content="https://www.alpertron.com.ar/fcubes.png">
<meta property="og:image:width" content="991">
<meta property="og:image:height" content="527">
<meta property="og:image:alt" content="Screenshot">
<meta property="og:locale" content="en_US">
<meta property="og:locale:alternate" content="es_ES">
<meta property="og:description" content="This finds the decomposition of a number into cubes.">
<meta property="article:published_time" content="2024-11-04">
<meta property="fb:app_id" content="1495228927625175">
<link rel="alternate" hreflang="es" href="https://www.alpertron.com.ar/SUMCUBOS.HTM">
<link rel="alternate" hreflang="en" href="https://www.alpertron.com.ar/FCUBES.HTM">
<link rel="manifest" href="fcubes.webmanifest">
<link rel="icon" href="favicon.ico" type="image/x-icon">
<link rel="apple-touch-icon" href="fcubes-icon-180px.png">
<link rel="canonical" href="https://www.alpertron.com.ar/FCUBES.HTM">
<script async src="https://www.googletagmanager.com/gtag/js?id=G-Q7PH40GPHC"></script>
<script>
window.dataLayer = window.dataLayer || [];
function gtag(){dataLayer.push(arguments);}
gtag('js', new Date());
gtag('config', 'G-Q7PH40GPHC');
</script>
<title>Sum of four cubes</title>
<style>
@media screen {
nav {background-color:#000080; width:100%; margin:0px; text-align:center}
nav ul {padding:0; margin:0 auto; list-style:none; display:inline-block}
nav li {float:left; position:relative; display:block; margin-top:0px; margin-bottom:0px; margin-left:5px; margin-right:5px; background-color:#000080; color:#FFFFFF; cursor: pointer; text-align:left}
nav li[aria-expanded="true"] {background-color:#004000; color:#FFFFFF}
nav li ul {display:none; position:absolute}
nav li[aria-expanded="true"] ul.alignleft {display:block; height:auto}
nav li[aria-expanded="true"] ul.alignright {display:block; height:auto; right:0px; background-color:#004000}
nav li ul li {clear:both; white-space: nowrap; border:0px; background-color:#004000; width:100%; padding-top:1em; padding-bottom:0.5em}
nav a:link{color:#FFFFFF; text-decoration:none}
nav a:visited{color:#FFFFFF; text-decoration:none}
nav a:hover{background-color:#004000; color:#FFFFFF; text-decoration:none}
nav a:active{background-color:#004000; color:#FFFFFF; text-decoration:none}
nav li ul li a:link{background-color:#004000; color:#FFFFFF; display:block; width:100%}
nav li ul li a:visited{background-color:#004000;color:#FFFFFF; display:block; width:100%}
nav li ul li a:hover{background-color:#FFFFFF; color:#004000; display:block; width:100%}
nav li ul li a:active{background-color:#FFFFFF; color:#004000; display:block; width:100%}
nav::after {clear:both}
.inputfbck{width: calc(100% - 10em);float:right;padding:3px;margin:0px;}
@media (max-width: 400px) { nav { font-size:0.7em;} }
@media (min-width: 400px) { nav { font-size:1em;} }
@media (min-width: 500px) {#formleft {float:left;width:50%;} #formright {float:right;width:50%;}}
}
@media print {nav, #footer {display:none;}}
.modal-header {padding: 2px 10px; background-color: #5cb85c; color: white}
.modal-body {padding: 2px 10px}
.modal-content {
position: absolute; top: 50%; left: 50%; transform: translate(-50%, -50%);
background-color: #fefefe;
padding: 0;
border: 1px solid #888;
width: 80%;
box-shadow: 0 4px 8px 0 rgba(0,0,0,0.2),0 6px 20px 0 rgba(0,0,0,0.19);
}
.modal {
display: none;
position: fixed;
z-index: 1;
left: 0;
top: 0;
width: 100%;
height: 100%;
overflow: auto;
background-color: rgb(0,0,0);
background-color: rgba(0,0,0,0.4);
}
input[type=text], input[type=email], input[type=number] {min-height:2em; border-radius:10px}
input[type=button], button {min-height:2.5em; min-width:2.5em; border-radius:5px}
#close {float:right}
#modal-header-text {font-size:1.5em}
#sending, #sentOK, #notSent {display:none}
.center {text-align:center}
#skip a {padding:6px; position:absolute; top:-40px; left:0px; color:white; border-right:1px solid white; border-bottom:1px solid white; border-bottom-right-radius:8px; background:#BF1722; transition:top 1s ease-out; z-index:100}
#skip a:focus {position:absolute; left:0px; top:0px; outline-color:transparent; transition: top .1s ease-in}
.bread {padding:0px;list-style:none; display:inline-block;}
.bread li {display:inline}
.bread li+li:before {content:"›"}
body {font-family: Arial, sans-serif; margin: 0; padding: 0;}
h1, .h2title {text-align:center}
#actions button {color: white; background-color: #3b3b3b; min-height:100%; border-radius:10px}
#actbtn {display:flex; flex-flow:row wrap; justify-content:space-around; min-height:3em}
.funcbtns {display:flex; justify-content:space-around; flex-flow:row wrap; margin-top:3px; margin-bottom:3px}
.funcbtns button {min-height:2.5em; min-width:2.5em; margin:3px}
fieldset {border-radius:10px}
.applet {margin-left: auto;margin-right: auto; border: 0px none;width:90%;text-align:center;background-color:#c0c0c0;padding:10px;border-radius:10px}
.newline {clear:both}
#valueapp, #wzdupper {display:grid}
#mode {grid-column:1; grid-row:1}
#output {grid-column:2; grid-row:1}
#wzdexam {margin-block-start:0; margin-block-end:0}
.atright {float:right}
#num {white-space:pre;overflow-wrap:normal;overflow:auto;margin:5px;width:100%;padding:3px}
#stop, #cont, #wizard, #feedback {display:none}
.lf,.labels {padding:0.2em; clear:both; width:100%}
.leftpar::before {content:" parenthesis ";position:absolute;top:-9999px;left:-9999px}
.rightpar::before {content:" close parenthesis ";position:absolute;top:-9999px;left:-9999px}
.bigger {font-size:150%}
.pad, #footer {padding:10px}
.hex {font-family: Courier, "Lucida Console", monospace}
.und {text-decoration: underline}
.new {color: #0000FF; font-weight:bold}
@media (min-width: 400px) {.input {width: calc(100% - 6em);float:right;padding:3px;margin:0px;}}
@media (max-width: 400px) {.input {width:100%;padding:3px;margin:0px;}}
@media (max-width: 53em) {
#actions {grid-column:1/3; grid-row:1}
#inputs {grid-column:1/3; grid-row:2}
#functions {grid-column:1/3; grid-row:3}
#output {grid-column:1; grid-row:2}
}
@media (min-width: 53em) {
#inputs {grid-column:1/3; grid-row:1}
#actions {grid-column:1; grid-row:2; width:320px}
#functions {grid-column:2/3; grid-row:2}
}
@media screen and (prefers-color-scheme: dark) {
body {color: #ddd; background-color: #121212}
.applet {background-color:#606060; color: #fff}
a {color: #a3d4a7}
a:link,a:active {color: #a3d4a7}
a:hover {color: #f5cba7}
a:visited {color: #d7bde2}
input, textarea {color: white; background-color: #3b3b3b}
button:disabled {color: #808080; background-color: #606060}
.new {color: #E0E000}
}
</style>
<noscript>
<style>
.applet {display:none}
</style>
</noscript>
</head>
<body>
<div id="skip"><a href="#main">Skip to main content</a></div>
<nav aria-label="Main navigation">
<ul role="menubar">
<li role="menuitem" aria-haspopup="true" aria-expanded="false" tabindex="0">Electronics
<ul role="menu" class="alignleft popup">
<li role="menuitem"><a href="INTEL.HTM" hreflang="es" title="All Intel microprocessors from the 4004 up to Pentium (Spanish only)">Intel Microprocessors</a></li>
</ul>
</li>
<li role="menuitem" aria-haspopup="true" aria-expanded="false" tabindex="-1">Mathematics
<ul role="menu" class="alignleft popup">
<li role="menuitem"><a href="CALTORS.HTM" title="Web applications with JavaScript and WebAssembly implementing calculators">Calculators</a></li>
<li role="menuitem"><a href="NUMBERT.HTM" title="Articles and programs about number theory">Number Theory</a></li>
<li role="menuitem"><a href="PROBLEMS.HTM" title="Interesting math problems">Problems</a></li>
</ul>
</li>
<li role="menuitem" aria-haspopup="true" aria-expanded="false" tabindex="-1">Programs
<ul role="menu" class="alignright popup">
<li role="menuitem"><a href="ASSEM386.HTM" title="Programs written in 80386 Assembler">Assembler 80386</a></li>
<li role="menuitem"><a href="JAVAPROG.HTM" title="Web applications with JavaScript and WebAssembly">Web applications</a></li>
<li role="menuitem"><a href="GAMES.HTM" title="Computer games">Games</a></li>
</ul>
</li>
<li class="alignright" role="menuitem" aria-haspopup="true" aria-expanded="false" tabindex="-1">Contact
<ul role="menu" class="alignright popup">
<li role="menuitem"><a href="EPERS.HTM" title="Personal information">Personal</a></li>
<li role="menuitem"><a href="FORM.HTM" title="Form to send comments">Comments</a></li>
<li role="menuitem"><a href="EGBOOK.HTM" title="Old and new guestbook">Guestbook</a></li>
<li role="menuitem"><a href="PRIVACY.HTM" title="Privacy Policy">Privacy</a></li>
<li role="menuitem"><a href="DONATION.HTM" title="Donations to the author of this Web site">Donations</a></li>
</ul>
</li>
</ul>
<ul class="atright"><li><a href="SUMCUBOS.HTM" hreflang="es" title="Esta página Web en español">ESP</a></li></ul>
</nav>
<main id="main">
<article>
<h1>Sum of four cubes</h1>
<ol class="bread" vocab="https://schema.org/" typeof="BreadcrumbList">
<li property="itemListElement" typeof="ListItem">
<a property="item" typeof="WebPage" href="ENGLISH.HTM"><span property="name">Alpertron</span></a>
<meta property="position" content="1">
</li>
<li property="itemListElement" typeof="ListItem">
<a property="item" typeof="WebPage" href="JAVAPROG.HTM"><span property="name">Web applications</span></a>
<meta property="position" content="2">
</li>
<li property="itemListElement" typeof="ListItem">
<span property="name">Sum of four cubes</span>
<meta property="position" content="3">
</li>
</ol>
<noscript><p><strong>The calculator does not work with Javascript disabled. Please check your browser settings.</strong></p></noscript>
<div class="applet" id="valueapp">
<div id="inputs">
<label for="num">Number to be decomposed in sum of cubes</label>
<textarea inputmode="numeric" id="num" rows="4" class="input"></textarea>
</div>
<fieldset id="actions"><legend>Actions</legend>
<div id="actbtn">
<button type="button" id="calc" title="Find sum of cubes. The remainder of the division between the input number and 9 must not be 4 or 5.">Sum of<br>cubes</button>
<button type="button" id="stop" title="Stop calculation">Stop</button>
<button type="button" id="helpbtn" title="Read information about this calculator">Help</button>
<button type="button" id="openwizard" title="Enter expressions and loops in an easy way">Open<br>wizard</button>
<button type="button" id="config" title="Change parameters used in the application">Config</button>
<button type="button" id="clrinput" title="Erase input box contents">Clear<br>input</button>
</div>
</fieldset>
<fieldset id="functions"><legend>Functions</legend>
<label for="funccat">Category:</label>
<select id="funccat">
<optgroup label="Functions or operators">
<option value="0" selected>Basic Math</option>
<option value="1">Batch processing</option>
<option value="2">Comparisons</option>
<option value="3">Logic</option>
<option value="4">Divisibility</option>
<option value="5">Recreational Math</option>
<option value="6">Number Theory</option>
<option value="7">Other</option>
</optgroup>
</select>
<span class="funcbtns" id="funcbtns">
<button type="button">(</button><button type="button">)</button><button type="button">⏎</button><button type="button">+</button><button type="button">-</button><button type="button">*</button><button type="button">/</button><button type="button">%</button><button type="button">^</button><button type="button">ans</button><button type="button">sqrt(</button><button type="button">iroot(</button><button type="button">Random(</button><button type="button">Abs(</button><button type="button">Sign(</button>
</span>
</fieldset>
</div>
<div class="pad">
<div id="help" aria-live="polite">
<p>This Web application finds the decomposition of any integer number not congruent to 4 or 5 (mod 9) into a sum of four cubes.</p>
<h2>Formulas</h2>
<p>The applet uses the following formulas:</p>
<ul>
<li>
6x = <span class="leftpar"></span>(x − 1<span class="rightpar"></span>)<span class="bigger">³</span> + <span class="leftpar"></span>(−x<span class="rightpar"></span>)<span class="bigger">³</span> + <span class="leftpar"></span>(−x<span class="rightpar"></span>)<span class="bigger">³</span> + <span class="leftpar"></span>(x + 1<span class="rightpar"></span>)<span class="bigger">³</span>
</li>
<li>
6x + 3 = x<span class="bigger">³</span> + <span class="leftpar"></span>(−x + 4<span class="rightpar"></span>)<span class="bigger">³</span> + <span class="leftpar"></span>(2x − 5<span class="rightpar"></span>)<span class="bigger">³</span> + <span class="leftpar"></span>(−2x + 4<span class="rightpar"></span>)<span class="bigger">³</span>
</li>
<li>
18x + 1 = <span class="leftpar"></span>(2x + 14<span class="rightpar"></span>)<span class="bigger">³</span> + <span class="leftpar"></span>(−2x − 23<span class="rightpar"></span>)<span class="bigger">³</span> + <span class="leftpar"></span>(−3x − 26<span class="rightpar"></span>)<span class="bigger">³</span> + <span class="leftpar"></span>(3x + 30<span class="rightpar"></span>)<span class="bigger">³</span>
</li>
<li>
18x + 7 = <span class="leftpar"></span>(x + 2<span class="rightpar"></span>)<span class="bigger">³</span> + <span class="leftpar"></span>(6x − 1<span class="rightpar"></span>)<span class="bigger">³</span> + <span class="leftpar"></span>(8x − 2<span class="rightpar"></span>)<span class="bigger">³</span> + <span class="leftpar"></span>(−9x + 2<span class="rightpar"></span>)<span class="bigger">³</span>
</li>
<li>
18x + 8 = <span class="leftpar"></span>(x − 5<span class="rightpar"></span>)<span class="bigger">³</span> + <span class="leftpar"></span>(−x + 14<span class="rightpar"></span>)<span class="bigger">³</span> + <span class="leftpar"></span>(−3x + 29<span class="rightpar"></span>)<span class="bigger">³</span> + <span class="leftpar"></span>(3x − 30<span class="rightpar"></span>)<span class="bigger">³</span>
</li>
<li>
54x + 20 = <span class="leftpar"></span>(3x − 11<span class="rightpar"></span>)<span class="bigger">³</span> + <span class="leftpar"></span>(−3x + 10<span class="rightpar"></span>)<span class="bigger">³</span> + <span class="leftpar"></span>(x + 2<span class="rightpar"></span>)<span class="bigger">³</span> + <span class="leftpar"></span>(−x + 7<span class="rightpar"></span>)<span class="bigger">³</span>
</li>
<li>
72x + 56 = <span class="leftpar"></span>(−9x + 4<span class="rightpar"></span>)<span class="bigger">³</span> + <span class="leftpar"></span>(x + 4<span class="rightpar"></span>)<span class="bigger">³</span> + <span class="leftpar"></span>(6x − 2<span class="rightpar"></span>)<span class="bigger">³</span> + <span class="leftpar"></span>(8x − 4<span class="rightpar"></span>)<span class="bigger">³</span>
</li>
<li>
108x + 2 = <span class="leftpar"></span>(−x − 22<span class="rightpar"></span>)<span class="bigger">³</span> + <span class="leftpar"></span>(x + 4<span class="rightpar"></span>)<span class="bigger">³</span> + <span class="leftpar"></span>(−3x − 41<span class="rightpar"></span>)<span class="bigger">³</span> + <span class="leftpar"></span>(3x + 43<span class="rightpar"></span>)<span class="bigger">³</span>
</li>
<li>
216x + 92 = <span class="leftpar"></span>(3x − 164<span class="rightpar"></span>)<span class="bigger">³</span> + <span class="leftpar"></span>(−3x + 160<span class="rightpar"></span>)<span class="bigger">³</span> + <span class="leftpar"></span>(x − 35<span class="rightpar"></span>)<span class="bigger">³</span> + <span class="leftpar"></span>(−x + 71<span class="rightpar"></span>)<span class="bigger">³</span>
</li>
<li>
270x + 146 = <span class="leftpar"></span>(−60x + 91<span class="rightpar"></span>)<span class="bigger">³</span> + <span class="leftpar"></span>(−3x + 13<span class="rightpar"></span>)<span class="bigger">³</span> + <span class="leftpar"></span>(22x − 37<span class="rightpar"></span>)<span class="bigger">³</span> + <span class="leftpar"></span>(59x − 89<span class="rightpar"></span>)<span class="bigger">³</span>
</li>
<li>
270x + 200 = <span class="leftpar"></span>(3x + 259<span class="rightpar"></span>)<span class="bigger">³</span> + <span class="leftpar"></span>(−3x − 254<span class="rightpar"></span>)<span class="bigger">³</span> + <span class="leftpar"></span>(x + 62<span class="rightpar"></span>)<span class="bigger">³</span> + <span class="leftpar"></span>(−x − 107<span class="rightpar"></span>)<span class="bigger">³</span>
</li>
<li>
270x + 218 = <span class="leftpar"></span>(−3x − 56<span class="rightpar"></span>)<span class="bigger">³</span> + <span class="leftpar"></span>(3x + 31<span class="rightpar"></span>)<span class="bigger">³</span> + <span class="leftpar"></span>(−5x − 69<span class="rightpar"></span>)<span class="bigger">³</span> + <span class="leftpar"></span>(5x + 78<span class="rightpar"></span>)<span class="bigger">³</span>
</li>
<li>
432x + 380 = <span class="leftpar"></span>(−3x + 64<span class="rightpar"></span>)<span class="bigger">³</span> + <span class="leftpar"></span>(3x − 80<span class="rightpar"></span>)<span class="bigger">³</span> + <span class="leftpar"></span>(2x − 29<span class="rightpar"></span>)<span class="bigger">³</span> + <span class="leftpar"></span>(−2x + 65<span class="rightpar"></span>)<span class="bigger">³</span>
</li>
<li>
540x + 38 = <span class="leftpar"></span>(5x − 285<span class="rightpar"></span>)<span class="bigger">³</span> + <span class="leftpar"></span>(−5x + 267<span class="rightpar"></span>)<span class="bigger">³</span> + <span class="leftpar"></span>(3x − 140<span class="rightpar"></span>)<span class="bigger">³</span> + <span class="leftpar"></span>(−3x + 190<span class="rightpar"></span>)<span class="bigger">³</span>
</li>
<li>
810x + 56 = <span class="leftpar"></span>(5x − 755<span class="rightpar"></span>)<span class="bigger">³</span> + <span class="leftpar"></span>(−5x + 836<span class="rightpar"></span>)<span class="bigger">³</span> + <span class="leftpar"></span>(9x − 1445<span class="rightpar"></span>)<span class="bigger">³</span> + <span class="leftpar"></span>(−9x + 1420<span class="rightpar"></span>)<span class="bigger">³</span>
</li>
<li>
1080x + 380 = <span class="leftpar"></span>(−x − 1438<span class="rightpar"></span>)<span class="bigger">³</span> + <span class="leftpar"></span>(x + 1258<span class="rightpar"></span>)<span class="bigger">³</span> + <span class="leftpar"></span>(−3x − 4037<span class="rightpar"></span>)<span class="bigger">³</span> + <span class="leftpar"></span>(3x + 4057<span class="rightpar"></span>)<span class="bigger">³</span>
</li>
<li>
1620x + 1334 = <span class="leftpar"></span>(−5x − 3269<span class="rightpar"></span>)<span class="bigger">³</span> + <span class="leftpar"></span>(5x + 3107<span class="rightpar"></span>)<span class="bigger">³</span> + <span class="leftpar"></span>(−9x − 5714<span class="rightpar"></span>)<span class="bigger">³</span> + <span class="leftpar"></span>(9x + 5764<span class="rightpar"></span>)<span class="bigger">³</span>
</li>
<li>
1620x + 1352 = <span class="leftpar"></span>(−5x + 434<span class="rightpar"></span>)<span class="bigger">³</span> + <span class="leftpar"></span>(5x − 353<span class="rightpar"></span>)<span class="bigger">³</span> + <span class="leftpar"></span>(9x − 722<span class="rightpar"></span>)<span class="bigger">³</span> + <span class="leftpar"></span>(−9x + 697<span class="rightpar"></span>)<span class="bigger">³</span>
</li>
<li>
2160x + 362 = <span class="leftpar"></span>(−5x − 180<span class="rightpar"></span>)<span class="bigger">³</span> + <span class="leftpar"></span>(5x + 108<span class="rightpar"></span>)<span class="bigger">³</span> + <span class="leftpar"></span>(−6x − 149<span class="rightpar"></span>)<span class="bigger">³</span> + <span class="leftpar"></span>(6x + 199<span class="rightpar"></span>)<span class="bigger">³</span>
</li>
<li>
6480x + 794 = <span class="leftpar"></span>(−5x − 83<span class="rightpar"></span>)<span class="bigger">³</span> + <span class="leftpar"></span>(5x + 11<span class="rightpar"></span>)<span class="bigger">³</span> + <span class="leftpar"></span>(−6x − 35<span class="rightpar"></span>)<span class="bigger">³</span> + <span class="leftpar"></span>(6x + 85<span class="rightpar"></span>)<span class="bigger">³</span>
</li>
</ul>
<p>
If n = 164, 596, 1892, 2324, 2756, 4052, 4484 (mod 6480) the following formula is used:
</p>
<p>
54x + 2 = <span class="leftpar"></span>(29484x<span class="bigger">²</span> + 2211x + 43<span class="rightpar"></span>)<span class="bigger">³</span> + <span class="leftpar"></span>(−29484x<span class="bigger">²</span> − 2157x − 41<span class="rightpar"></span>)<span class="bigger">³</span> + <span class="leftpar"></span>(9828x<span class="bigger">²</span> + 485x + 4<span class="rightpar"></span>)<span class="bigger">³</span> + <span class="leftpar"></span>(−9828x<span class="bigger">²</span> − 971x − 22<span class="rightpar"></span>)<span class="bigger">³</span>
</p>
<p>
If n = 254, 902, 1442, 1874, 1982, 2414, 3062, 3494, 3602, 4034, 4142, 5114, 5222, 5654, 5762, 6302 (mod 6480) a method due to Demjanenko is used. Notice that the results can have hundreds of digits in this case.
</p>
<p>
In the remaining cases the number n is replaced by −n and then all solutions are multiplied by −1.
</p>
<div id="expr">
<h2>Expressions</h2>
<p>You can enter numbers or numeric expressions in the input box including parentheses. The operations supported are:</p>
<ul>
<li> + for addition</li>
<li> - for subtraction</li>
<li> * for multiplication</li>
<li> / for integer division</li>
<li> % for modulus (remainder of the integer division)</li>
<li> ^ or ** for exponentiation (the exponent must be greater than or equal to zero).</li>
<li> <strong><</strong>, <strong>==</strong>, <strong>></strong>; <strong><=</strong>, <strong>>=</strong>, != for comparisons. The operators return zero for false and -1 for true.</li>
<li> <strong>Ans</strong>: retrieves the last answer.</li>
<li> <strong>AND</strong>, <strong>OR</strong>, <strong>XOR</strong>, <strong>NOT</strong> for binary logic. The operations are done in binary (base 2). Positive (negative) numbers are prepended with an infinite number of bits set to zero (one).</li>
<li> <strong>SHL</strong> or <strong><<</strong>: When <var>b</var> ≥ 0, <var>a</var> SHL <var>b</var> shifts <var>a</var> left the number of bits specified by <var>b</var>. This is equivalent to <var>a</var> × 2<sup><var>b</var></sup>. Otherwise, <var>a</var> SHL <var>b</var> shifts <var>a</var> right the number of bits specified by −<var>b</var>. This is equivalent to floor(<var>a</var> / 2<sup>−<var>b</var></sup>). Example: 5 SHL 3 = 40.</li>
<li> <strong>SHR</strong> or <strong>>></strong>: When <var>b</var> ≥ 0, <var>a</var> SHR <var>b</var> shifts <var>a</var> right the number of bits specified by <var>b</var>. This is equivalent to floor(<var>a</var> / 2<sup><var>b</var></sup>). Otherwise, <var>a</var> SHR <var>b</var> shifts <var>a</var> left the number of bits specified by −<var>b</var>. This is equivalent to <var>a</var> × 2<sup>−<var>b</var></sup>. Example: -19 SHR 2 = -5.</li>
<li> <strong>n!</strong>: factorial (<var>n</var> must be greater than or equal to zero). Example: 6! = 6 × 5 × 4 × 3 × 2 = 720.</li>
<li> <strong>n!! ... !</strong>: multiple factorial (<var>n</var> must be greater than or equal to zero). It is the product of <var>n</var> times <var>n</var> − <var>k</var> times <var>n</var> − <var>2k</var> ... (all numbers greater than zero) where <var>k</var> is the number of exclamation marks. Example: 7!! = 7 × 5 × 3 × 1 = 105.</li>
<li> <strong>p#</strong>: primorial (product of all primes less or equal than <var>p</var>). Example: 12# = 11 × 7 × 5 × 3 × 2 = 2310.</li>
<li> <strong>B(n)</strong>: Previous probable prime before <em>n</em>. Example: B(24) = 23.</li>
<li> <strong>F(n)</strong>: Fibonacci number F<sub>n</sub> from the sequence 0, 1, 1, 2, 3, 5, 8, 13, 21, etc. where each element equals the sum of the previous two members of the sequence. Example: F(7) = 13.</li>
<li> <strong>L(n)</strong>: Lucas number L<sub>n</sub> = F<sub><var>n</var>-1</sub> + F<sub><var>n</var>+1</sub></li>
<li> <strong>N(n)</strong>: Next probable prime after <em>n</em>. Example: N(24) = 29.</li>
<li> <strong>P(n)</strong>: Unrestricted Partition Number (number of decompositions of <var>n</var> into sums of integers without regard to order). Example: P(4) = 5 because the number 4 can be partitioned in 5 different ways: 4 = 3+1 = 2+2 = 2+1+1 = 1+1+1+1.</li>
<li> <strong>Gcd(m,n, ...)</strong>: Greatest common divisor of these integers. Example: GCD(12, 16) = 4.</li>
<li> <strong>Lcm(m,n, ...)</strong>: Least common multiple of these integers. Example: LCM(12, 16, 24) = 48.</li>
<li> <strong>FloorDiv(m,n)</strong>: integer part of the quotient of <var>m</var> divided by <var>n</var>. Examples: floordiv(10, 7) = 1 and floordiv(-10, 7) = -2.</li>
<li> <strong>Mod(m,n)</strong>: value of <var>m</var> modulo the absolute value of <var>n</var>. Examples: Mod(10, 7) = 3 and Mod(-10, 7) = 4.</li>
<li> <strong>Modinv(m,n)</strong>: inverse of <var>m</var> modulo <var>n</var>, only valid when <var>m</var> and <var>n</var> are coprime, meaning that they do not have common factors. Example: Modinv(3,7) = 5 because 3 × 5 ≡ 1 (mod 7)</li>
<li> <strong>Modpow(m,n,r)</strong>: finds <var>m</var><sup><var>n</var></sup> modulo <var>r</var>. Example: Modpow(3, 4, 7) = 4, because 3<sup>4</sup> ≡ 4 (mod 7).</li>
<li> <strong>Totient(n)</strong>: finds the number of positive integers less than <var>n</var> which are relatively prime to <var>n</var>. Example: Totient(6) = 2 because 1 and 5 do not have common factors with 6.</li>
<li> <strong>Jacobi(m,n)</strong>: obtains the Jacobi symbol of <var>m</var> and <var>n</var>. When the second argument is prime, the result is zero when <var>m</var> is multiple of <var>n</var>, it is one if there is a solution of <var>x</var>² ≡ <var>m</var> (mod <var>n</var>) and it is equal to −1 when the mentioned congruence has no solution.</li>
<li> <strong>Random(m,n)</strong>: integer random number between <var>m</var> and <var>n</var>.</li>
<li> <strong>Abs(n)</strong>: absolute value of <var>n</var>.</li>
<li> <strong>Sign(n)</strong>: returns zero if <var>n</var> is zero, −1 if negative or 1 if positive.</li>
<li> <strong>IsPrime(n)</strong>: returns zero if <var>n</var> is not probable prime, −1 if it is. Example: IsPrime(5) = −1.</li>
<li> <strong>Sqrt(n)</strong>: Integer part of the square root of the argument.</li>
<li> <strong>Iroot(n,r)</strong>: Integer r-root of the first argument. Example: Iroot(8, 3) = 2.</li>
<li> <strong>NumDigits(n,r)</strong>: Number of digits of <var>n</var> in base <var>r</var>. Example: NumDigits(13, 2) = 4 because 13 in binary (base 2) is expressed as 1101.</li>
<li> <strong>SumDigits(n,r)</strong>: Sum of digits of <var>n</var> in base <var>r</var>. Example: SumDigits(213, 10) = 6 because the sum of the digits expressed in decimal is 2+1+3 = 6.</li>
<li> <strong>RevDigits(n,r)</strong>: finds the value obtained by writing backwards the digits of <var>n</var> in base <var>r</var>. Example: RevDigits(213, 10) = 312.</li>
</ul>
<p>You can use the prefix <em>0x</em> for hexadecimal numbers, for example 0x38 is equal to 56.</p>
</div>
<h2>Configuration</h2>
<p>You can change settings for this application by pressing the Config button when a factorization is not in progress. A new window will pop up where you can select different settings:</p>
<ul>
<li><strong>Digits per group</strong>: In order to improve readability, big numbers are separated by spaces forming groups of a fixed number of digits. With this input box, you can determine the number of digits in a group.</li>
<li><strong>Hexadecimal output</strong>: If this checkbox is set, the numbers are shown in hexadecimal format instead of decimal, which is the common notation.
To enter numbers in hexadecimal format, you will need to precede them by the string 0x. For instance, 0x38 = 56. The program shows hexadecimal numbers with monospaced font.</li>
<li><strong>Keyboard</strong>: This enables the user to select between numeric or complete (alphanumeric) virtual keyboard. The virtual keyboard appears on the screen when the user selects an input box on touch screens.
</ul>
<p>The configuration is saved in your device, so when you start again the calculator, all settings remain the same.</p>
<h2>Batch processing</h2>
<p>Write an expression per line, then press the Sum if cubes button. The output will be placed in the lower pane.</p>
<p>Blank lines or comment lines (which start with a numeral '#' character) will be replicated on the lower pane.</p>
<p>Expression loop: with the following syntax you can decompose several numbers as a sum of cubes by typing only one line.
You have to type four or five expressions separated by semicolons:</p>
<ul>
<li>First expression: It must start with the string 'x=' and it sets the first value of x.</li>
<li>Second expression: It must start with the string 'x=' and it sets the next value of x.</li>
<li>Third expression: It holds the end expression condition. If it is equal to zero (meaning false) the loop finishes, otherwise the loop continues.</li>
<li>Fourth expression: It holds the expression to be expressed as a sum of cubes.</li>
<li>Optional fifth expression: If this expression is different from zero (meaning true), the fourth expression is processed, and if is zero (meaning false), the fourth expression is ignored.</li>
</ul>
<p>Except for the first expression, all other expressions must include the variable <var>x</var> and/or the counter <var>c</var>.</p>
<p>If the end expression is false after processing 1000 numbers, the Continue button will appear. Pressing this button will make the program to process the next 1000 numbers and so on.</p>
<p>Example 1: Find the decomposition in a sum of cubes of the numbers from 0 to 5000.
The line to type is: <code>x=0;x=x+1;x<=5000;x</code>. The calculator will show the results in blocks of 1000 values. You will need to press the Continue button to get the next block.</p>
<p>Example 2: Find the decomposition in a sum of cubes of the first 100 numbers of the form prime minus one.
The line to type is: <code>x=3;x=n(x);c<=100;x-1</code>.</p>
<p>The fourth expression can be changed to a format string and several expressions. The format string indicates what is displayed. Inside this string you can specify conversion clauses that start by a percent sign and they are case insensitive:</p>
<ul>
<li><strong>%D</strong>: show expression as a decimal number.</li>
<li><strong>%X</strong>: show expression as a hexadecimal number.</li>
<li><strong>%L</strong>: show <strong>yes</strong> if the expression is not zero and <strong>no</strong> if it is zero.</li>
<li><strong>%FD</strong>: decompose expression as a sum of powers decimal number.</li>
<li><strong>%FX</strong>: show expression as a hexadecimal number.</li>
</ul>
<p>The expressions are written after the string, separated by colons. There must be a colon also between the string and the first expression.</p>
<p>To print a percent sign, you have to write two percent signs, and a quote is represented by a percent sign followed by a quote.</p>
<p>Example 3: For each number between -100 and 100, show whether the number is prime and then the decomposition in cubes both in decimal and hexadecimal.</p>
<p>The line to write is: <code>x=-100; x=x+1; x<=100; "%d is prime: %l, %Fd, %Fx":x:isprime(x):x:x</code>
<div class="noand">
<h2>Source code</h2>
<p>You can download the source of the current program and the old sum of four cubes applet from <a href="https://github.com/alpertron/calculators">GitHub</a>. Notice that the source code is in C language and you need the <a href="https://emscripten.org/docs/getting_started/downloads.html">Emscripten</a> environment in order to generate JavaScript.</p>
</div>
<p>Written by Dario Alpern. Last updated 10 November 2024.</p>
</div>
<div id="helphelp"></div>
<div id="result" aria-live="polite"></div>
<div id="status"></div>
</div>
<div id="cont" class="pad">
<input type="button" id="continue" value="Continue" title="Show more results. Pressing this button will delete old results.">
</div>
<div id="footer">
<p><span class="new">New!</span> You can download an application for Android that includes this calculator from <a href="https://play.google.com/store/apps/details?id=ar.com.alpertron.calculators">Google Play</a>.</p>
<p>If you find any error or you have a comment, please fill in the <a href="#" id="formlink">form</a>.</p>
<p>If you like these calculators and you want to support free software with no annoying advertisements, you can <a href="https://www.PayPal.com/cgi-bin/webscr?cmd=_s-xclick&hosted_button_id=MR65QPWZM5JT6&source=url">donate through PayPal</a>.</p>
</div>
</article>
</main>
<aside id="wizard" aria-label="Wizard">
<h2 class="h2title">Sum of cubes wizard</h2>
<div class="applet">
<div id="wzdupper">
<fieldset id="output">
<legend>Output</legend>
<input type="radio" name="output" id="decW"><label for="decW">Decimal</label><br>
<input type="radio" name="output" id="hexW"><label for="hexW">Hexadecimal</label><br>
</fieldset>
<fieldset id="mode">
<legend>Wizard mode</legend>
<input type="radio" name="mode" id="oneexpr"><label for="oneexpr">Process one expression</label><br>
<input type="radio" name="mode" id="loop"><label for="loop">Process several expressions in a loop</label><br>
</fieldset>
</div>
<label for="wzdinput" id="wzddesc">1</label>
<br class="newline">
<input type="text" inputmode="numeric" id="wzdinput" value="" placeholder="Number or numerical expression" class="input">
<br class="newline">
<p id="wzdexam"> </p>
<input type="button" id="next" value="Next" title="Next step of wizard">
<input type="button" id="cancel" value="Cancel" title="Exit wizard">
<div id="wzdfunccatblock">
<label for="wzdfunccat">Function category:</label>
<select id="wzdfunccat">
<optgroup label="Functions or operators">
<option value="0" selected>Basic Math</option>
<option value="1">Comparisons</option>
<option value="2">Logic</option>
<option value="3">Divisibility</option>
<option value="4">Recreational Math</option>
<option value="5">Number Theory</option>
<option value="6">Other</option>
</optgroup>
</select>
</div>
<div class="funcbtns" id="wzdfuncbtns"></div>
</div>
<div id="exprwiz"></div>
<ul>
<li id="C">Variable <var>C</var>: number of expressions already processed.</li>
<li id="X">Variable <var>X</var>: variable changed on each iteration of the loop.</li>
</ul>
</aside>
<div id="modal-config" class="modal" role="dialog" aria-labelledby="conf">
<div class="modal-content">
<div class="modal-header"><span id="close-config" aria-label="close" class="atright">×</span><p id="conf">Configuration</p></div>
<div class="modal-body">
<div class="applet">
<fieldset>
<legend>Configuration parameters</legend>
<p><label for="digits">Digits per group</label> <input type="number" id="digits" value="6" min="0" max="10000" step="1"></p>
<p><label for="kbd">Keyboard: </label><select id="kbd"><option value="numeric">Numeric</option><option value="comp">Complete</option></select>
<p><input type="checkbox" id="hex"><label for="hex">Hexadecimal output</label></p>
</fieldset>
<p><input type="button" id="save-config" value="Save" title="Save configuration"><input type="button" id="cancel-config" value="Cancel" title="Discard changes to configuration"></p>
</div>
</div></div></div>
<aside id="feedback" aria-label="Feedback form">
<h2 class="h2title">Feedback form</h2>
<form class="applet" id="formfeedback">
<input type="hidden" name="subject" value="Sum of cubes calculator feedback">
<div id="formleft">
<div class="labels"><label for="name">Your name is:</label><input class="inputfbck" type="text" name="name" maxlength="40" id="name" autocomplete="name"></div>
<div class="labels"><label for="age">Age:</label><input class="inputfbck" type="number" name="age" min="0" max="999" id="age"></div>
<div class="labels"><label for="city">City:</label><input class="inputfbck" type="text" name="city" maxlength="70" id="city" autocomplete="address-level2"></div>
<div class="labels"><label for="province">Province/State:</label><input class="inputfbck" type="text" name="province" maxlength="70" id="province" autocomplete="address-level1"></div>
<div class="labels"><label for="country">Country:</label><input class="inputfbck" type="text" name="country" maxlength="70" id="country" autocomplete="country-name"></div>
<div class="labels"><label for="reply">E-mail address:</label><input class="inputfbck" type="email" name="reply" maxlength="70" id="reply" autocomplete="email"></div>
<p>All fields are optional. Enter your e-mail address if you want a reply from the author of this application.</p>
<p><input type="checkbox" id="adduserdata"><label for="adduserdata">Send expression to be decomposed in sum of cubes</label></p>
<input type="hidden" name="userdata" value="" id="userdata">
</div>
<div id="formright">
<label for="comments">Please feel free to add comments:</label><br>
<textarea name="Comments" rows="7" cols="40" id="comments"></textarea>
<p><label for="how">How did you find my page?</label><br>
<select name="how" title="How did you find my page?" id="how">
<optgroup label="Select response">
<option value="from a search engine" selected>From a search engine</option>
<option value="from a friend">From a friend</option>
<option value="from a link">From a link</option>
<option value="from Wikipedia">From Wikipedia or another reference</option>
<option value="other">Other</option>
</optgroup>
</select></p>
<fieldset><legend>Are the programs instructive?</legend>
<input type="radio" name="Instructive" value="Yes" id="insyes"><label for="insyes">Yes</label>
<input type="radio" name="Instructive" value="No" id="insno"><label for="insno">No</label>
</fieldset>
<fieldset><legend>Are the programs interesting?</legend>
<input type="radio" name="Interesting" value="Yes" id="intyes"><label for="intyes">Yes</label>
<input type="radio" name="Interesting" value="No" id="intno"><label for="intno">No</label>
</fieldset>
<p><button type="submit" disabled="disabled" id="formsend" title="Deliver this form">Send it in!</button>
<button type="reset">Reset</button>
<button type="button" id="formcancel" title="Do not deliver this form">Cancel</button></p>
</div>
<div class="lf"></div>
</form>
</aside>
<aside id="sending">
<p>Sending comments...</p>
</aside>
<aside id="sentOK">
<p>Feedback sent successfully.</p>
<div class="center"><button type="button" id="btnSentOK">Go back</button></div>
</aside>
<aside id="notSent">
<p>Feedback could not be sent.</p>
<div class="center"><button type="button" id="btnNotSent">Go back</button></div>
</aside>
<script type="text/wasmb64" id="wasmb64">
</script>
<script>
<!--
//-->
</script>
<script type="text/js-worker" id="worker">
</script>
<script type="application/ld+json">
{
"@context": "https://schema.org",
"@type": "WebApplication",
"browserRequirements": "Requires HTML5. Requires Javascript.",
"name": "Sum of four cubes",
"description": "Web application that finds the decomposition of a number into cubes.",
"image": ["https://www.alpertron.com.ar/fcubes.png"],
"datePublished": "2024-11-04",
"dateModified": "2024-11-04",
"operatingSystem": "Any",
"applicationCategory": "EducationalApplication",
"author": {
"@type": "Person",
"name": "Dario Alpern"
},
"aggregateRating": {
"@type": "AggregateRating",
"ratingValue": "3.8",
"ratingCount": "14"
},
"inLanguage": "en",
"license": "https://www.gnu.org/licenses/gpl-3.0.en.html",
"isAccessibleForFree": true,
"offers": {
"@type": "Offer",
"availability": "https://schema.org/OnlineOnly",
"price": "0",
"priceCurrency": "USD"
}
}
</script>
</body>
</html>