cp's OEIS Frontend

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.

A090029 Number of distinct lines through the origin in 7-dimensional cube of side length n.

This page as a plain text file.
%I A090029 #15 Mar 31 2021 10:47:54
%S A090029 0,127,2059,16129,75811,277495,804973,2078455,4702531,9905365,
%T A090029 19188793,35533303,61846723,104511583,168681913,266042113,405259513,
%U A090029 607140745,883046011,1269174145,1780715833,2472697501,3366818491,4548464341
%N A090029 Number of distinct lines through the origin in 7-dimensional cube of side length n.
%C A090029 Equivalently, lattice points where the GCD of all coordinates = 1.
%F A090029 a(n) = A090030(7, n).
%F A090029 a(n) = (n+1)^7 - 1 - Sum_{j=2..n+1} a(floor(n/j)). - _Chai Wah Wu_, Mar 30 2021
%e A090029 a(2) = 2059 because the 2059 points with at least one coordinate=2 all make distinct lines and the remaining 127 points and the origin are on those lines.
%t A090029 aux[n_, k_] := If[k == 0, 0, (k + 1)^n - k^n - Sum[aux[n, Divisors[k][[i]]], {i, 1, Length[Divisors[k]] - 1}]];lines[n_, k_] := (k + 1)^n - Sum[Floor[k/i - 1]*aux[n, i], {i, 1, Floor[k/2]}] - 1;Table[lines[7, k], {k, 0, 40}]
%o A090029 (Python)
%o A090029 from functools import lru_cache
%o A090029 @lru_cache(maxsize=None)
%o A090029 def A090029(n):
%o A090029     if n == 0:
%o A090029         return 0
%o A090029     c, j = 1, 2
%o A090029     k1 = n//j
%o A090029     while k1 > 1:
%o A090029         j2 = n//k1 + 1
%o A090029         c += (j2-j)*A090029(k1)
%o A090029         j, k1 = j2, n//j2
%o A090029     return (n+1)**7-c+127*(j-n-1) # _Chai Wah Wu_, Mar 30 2021
%Y A090029 Cf. A000225, A001047, A060867, A090020, A090021, A090022, A090023, A090024 are for n dimensions with side length 1, 2, 3, 4, 5, 6, 7, 8, respectively. A049691, A090025, A090026, A090027, A090028, A090029 are this sequence for 2, 3, 4, 5, 6, 7 dimensions. A090030 is the table for n dimensions, side length k.
%K A090029 nonn
%O A090029 0,2
%A A090029 _Joshua Zucker_, Nov 25 2003