2
$\begingroup$

I'm trying to write a code for finding the number of distinct lines in a 3d cube of size n. I started counting manually for $n = 1, 2, 3$ and $4$. I got the sequence: $0, 7, 19, 49, 91 ..$

Is there a simple function of n that governs this sequence?

  • 2
    Use OEIS: http://oeis.o$r$g/A0900252012-06-14

1 Answers 1

2

It is shown in OEIS A090025 where the formula $a(n) = \sum_{k=1}^n\mu(k)((\lfloor n/k\rfloor+1)^3-1)$is given. You can decide if you think that is simple.

  • 0
    I mean fast in computation not necessarily simple2012-06-14