This is a front-end for the Online Encyclopedia of Integer Sequences, made by Christian Perfect. The idea is to provide OEIS entries in non-ancient HTML, and then to think about how they're presented visually. The source code is on GitHub.
%I A098928 #61 Jan 14 2025 09:06:31 %S A098928 0,1,9,36,100,229,473,910,1648,2795,4469,6818,10032,14315,19907,27190, %T A098928 36502,48233,62803,80736,102550,128847,160271,197516,241314,292737, %U A098928 352591,421764,501204,592257,696281,814450,948112,1098607,1267367 %N A098928 Number of cubes that can be formed from the points of a cubical grid of n X n X n points. %C A098928 Skew cubes are allowed. %H A098928 Baitian Li, <a href="/A098928/b098928.txt">Table of n, a(n) for n = 1..10000</a> (terms 1..101 from E. J. Ionascu and R. A. Obando) %H A098928 E. J. Ionascu and R. A. Obando, <a href="http://arxiv.org/abs/1003.4569">Counting all cubes in {0,1,...,n}^3</a>, arXiv:1003.4569 [math.NT], 2010. %H A098928 Eugen J. Ionascu and Andrei Markov, <a href="http://dx.doi.org/10.1016/j.jnt.2010.07.008">Platonic solids in Z^3</a>, Journal of Number Theory, Volume 131, Issue 1, January 2011, Pages 138-145. %H A098928 Eugen J. Ionascu and R. A. Obando, <a href="http://www.emis.de/journals/INTEGERS/papers/a9self/a9self.Abstract.html">Cubes in {0,1,...,N}^3</a>, INTEGERS, 12A (2012), #A9. - From _N. J. A. Sloane_, Feb 05 2013 %H A098928 I. Larrosa, <a href="https://problemcorner.missouristate.edu/POW08_03.html">SMSU Problem Corner</a>. %H A098928 Baitian Li, <a href="/A098928/a098928.txt">C++ program for A098928</a> %e A098928 For n = 3 there are 8 cubes of volume 1 and 1 cube of volume 8; thus a(3)=9. - _José María Grau Ribas_, Mar 15 2014 %e A098928 a(6)=229 because we can place 15^2 cubes in a 6 X 6 X 6 cubical grid with their edges parallel to the faces of the grid, plus 4 cubes of edge 3 with a vertex in each face of the lattice and the other two vertices on a diagonal. %t A098928 Needs["Quaternions`"]; %t A098928 (* Initialize variables *) %t A098928 R = 20; %t A098928 NN = 1010; %t A098928 (* Quaternion operations *) %t A098928 test[q_Quaternion] := %t A098928 Module[{unit, res, a, b, c, u, v, w, p}, %t A098928 If[Round[Norm[q]] > R, Return[]]; %t A098928 If[q == Quaternion[0, 0, 0, 0], Return[]]; %t A098928 unit = Quaternion[0, 1, 0, 0]; %t A098928 res = q ** unit ** Conjugate[q]; %t A098928 a = Abs[res[[2]]] + Abs[res[[3]]] + Abs[res[[4]]]; %t A098928 unit = Quaternion[0, 0, 1, 0]; %t A098928 res = q ** unit ** Conjugate[q]; %t A098928 b = Abs[res[[2]]] + Abs[res[[3]]] + Abs[res[[4]]]; %t A098928 unit = Quaternion[0, 0, 0, 1]; %t A098928 res = q ** unit ** Conjugate[q]; %t A098928 c = Abs[res[[2]]] + Abs[res[[3]]] + Abs[res[[4]]]; %t A098928 For[i = 1, i <= (R - 1)/Max[a, b, c], i++, %t A098928 If[SquareFreeQ[i], {u = a*i; %t A098928 v = b*i; %t A098928 w = c*i; %t A098928 p = Max[u, v, w] + 1; %t A098928 coe[[p + 1, 4]] += (1); %t A098928 coe[[p + 1, 3]] -= (u + v + w); %t A098928 coe[[p + 1, 2]] += (u*v + v*w + w*u); %t A098928 coe[[p + 1, 1]] -= (u*v*w)}]]]; %t A098928 (* Set up coefficient matrix *) %t A098928 coe = ConstantArray[0, {NN, 4}]; %t A098928 (* Loop through quaternions *) %t A098928 rt = Ceiling[Sqrt[R]] + 1; %t A098928 For[s = -rt, s <= rt, s++, %t A098928 For[x = -rt, x <= rt, x++, %t A098928 For[y = -rt, y <= rt, y++, %t A098928 For[z = -rt, z <= rt, z++, test[Quaternion[s, x, y, z]]; %t A098928 test[Quaternion[s + 0.5, x + 0.5, y + 0.5, z + 0.5]];]]]]; %t A098928 newCoe = coe; %t A098928 newCoe[[2 ;; ;; 2]] = coe[[2 ;; ;; 2]]/2; %t A098928 (* Calculate and output results *) %t A098928 For[i = 2, i <= R + 1, i++, ans = 0; %t A098928 For[j = 4, j >= 1, j--, newCoe[[i, j]] += newCoe[[i - 1, j]]; %t A098928 ans = ans*(i - 1) + newCoe[[i, j]]; %t A098928 ]; %t A098928 Print[i - 1, " ", ans/24];]; %t A098928 (* _Haomin Yang_, Aug 29 2023 *) %o A098928 (C++) // see link above %Y A098928 Cf. A103158. %Y A098928 Cf. A000537 (without skew cubes), A002415 (number of squares with corners on an n X n grid), A108279, A102698. %K A098928 nonn %O A098928 1,3 %A A098928 _Ignacio Larrosa Cañestro_, Oct 19 2004, Sep 29 2009 %E A098928 Edited by _Ray Chandler_, Apr 05 2010 %E A098928 Further edited by _N. J. A. Sloane_, Mar 31 2016