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.

A320577 Number of isosceles triangles whose vertices are the vertices of a regular n-gon.

Original entry on oeis.org

1, 4, 10, 8, 21, 24, 30, 40, 55, 52, 78, 84, 95, 112, 136, 132, 171, 180, 196, 220, 253, 248, 300, 312, 333, 364, 406, 400, 465, 480, 506, 544, 595, 588, 666, 684, 715, 760, 820, 812, 903, 924, 960, 1012, 1081, 1072, 1176, 1200, 1241, 1300, 1378, 1368, 1485
Offset: 3

Views

Author

Halil Ibrahim Kanpak, Oct 15 2018

Keywords

Comments

Inspired by question 12 of the Turkish National Mathematics Olympics 2015 (see the link).

Programs

  • Maple
    a := proc(n) local m; m := abs(mods(n, 6));
    if m = 0 or m = 3 then m := (10 - m)/3 fi; n*(n - m)/2 end:
    seq(a(n), n=3..100); # Peter Luschny, Oct 20 2018
  • Mathematica
    a[n_]:=If[Mod[n,6]==1 || Mod[n,6]==5, Binomial[n,2], If[Mod[n,6]==2 || Mod[n,6]==4,  n*(n-2)/2 , If[Mod[n,6]==3, n*(3n-7)/6 ,   n*(3n-10)/6 ]]]; Array[a, 20, 3] (* Stefano Spezia, Oct 16 2018 *)
  • PARI
    Vec(x^3*(1 + 5*x + 13*x^2 + 11*x^3 + 5*x^4 + x^5) / ((1 - x)^3*(1 + x)^2*(1 + x + x^2)^2) + O(x^40)) \\ Colin Barker, Oct 17 2018
  • Python
    for n in range(3, 101):
        m = n % 6
        if m == 1 or m == 5: a = (n*(n-1)) // 2
        elif m==2 or m == 4: a = (n*(n-2)) // 2
        elif m==3          : a = (n*(3*n-7)) // 6
        else               : a = (n*(3*n-10)) // 6
        print(a, end=", ")
    

Formula

a(n) = n*(n-1)/2 if n mod 6 = 1 or 5 n*(n-2)/2 if n mod 6 = 2 or 4 n*(3n-7)/6 if n mod 6 = 3 n*(3n-10)/6 otherwise.
Alternatively, with the least absolute modulo 'mods' and m = abs(mods(n, 6)), a(n) = n*(n - k)/2 where k = m if m in {1, 2} and otherwise k = (10 - m)/3. - Peter Luschny, Oct 20 2018
From Colin Barker, Oct 17 2018: (Start)
G.f.: x^3*(1 + 5*x + 13*x^2 + 11*x^3 + 5*x^4 + x^5) / ((1 - x)^3*(1 + x)^2*(1 + x + x^2)^2).
a(n) = -a(n-1) + a(n-2) + 3*a(n-3) + 2*a(n-4) - 2*a(n-5) - 3*a(n-6) - a(n-7) + a(n-8) + a(n-9) for n>11.
(End)
a(n) = n*floor((n-1)/2)-(2/3)*n*[n==0 (mod 3)]. - Hoang Xuan Thanh, May 22 2025