login

Year-end appeal: Please make a donation to the OEIS Foundation to support ongoing development and maintenance of the OEIS. We are now in our 61st year, we have over 378,000 sequences, and we’ve reached 11,000 citations (which often say “discovered thanks to the OEIS”).

A362869
a(n) is equal to the number of cells in one octant of the octagon of unit squares with side equal n.
1
1, 2, 8, 11, 22, 27, 43, 50, 71, 80, 106, 117, 148, 161, 197, 212, 253, 270, 316, 335, 386, 407, 463, 486, 547, 572, 638, 665, 736, 765, 841, 872, 953, 986, 1072, 1107, 1198, 1235, 1331, 1370, 1471, 1512, 1618, 1661, 1772, 1817, 1933, 1980, 2101, 2150, 2276
OFFSET
1,2
COMMENTS
The octagon is obtained from a square of side 3n-2 cells by removing a triangle of cells from each of the four corners.
FORMULA
a(n) = k*(k + 1)/2 - floor(n^2/4), where k = ceiling((n + 2*(n - 1))/2).
G.f.: x*(1 + x + 4*x^2 + x^3)/((1 - x)^3*(1 + x)^2). - Stefano Spezia, May 07 2023
EXAMPLE
For n=3, the octagon is a square of side 3n-2 = 7 with corners chopped to leave each side with 3 "*",
* * *
* * * * *
* * * * * * *
@ @ @ @ * * *
@ @ @ * * * *
@ * * * *
* * *
The a(3) = 8 cells marked "@" are an eighth of the figure and are the primitive cells in the sense that other cells map to them by rotations or reflections.
MATHEMATICA
LinearRecurrence[{1, 2, -2, -1, 1}, {1, 2, 8, 11, 22}, 100] (* Paolo Xausa, Oct 16 2023 *)
PROG
(Java)
import java.util.function.Function;
import java.util.stream.IntStream;
public class Main {
private static int A362869(int n) {
Function<Integer, Integer> trianglarNumber = p -> p * (p + 1) / 2;
Function<Integer, Integer> quarterOfSquareNumber = p -> p * p / 4;
int k = (n + 2 * (n - 1) + 1) / 2;
return trianglarNumber.apply(k) - quarterOfSquareNumber.apply(n);
}
public static void main(String[] args) {
IntStream.range(1, 100).forEach(n -> System.out.print(A362869(n) + ", "));
}
}
CROSSREFS
Sequence in context: A009420 A189328 A090746 * A234924 A336771 A174114
KEYWORD
nonn,easy
AUTHOR
Anatoliy A. Abramov, May 07 2023
STATUS
approved