|
|
A006561
|
|
Number of intersections of diagonals in the interior of a regular n-gon.
(Formerly M3833)
|
|
45
|
|
|
0, 0, 0, 1, 5, 13, 35, 49, 126, 161, 330, 301, 715, 757, 1365, 1377, 2380, 1837, 3876, 3841, 5985, 5941, 8855, 7297, 12650, 12481, 17550, 17249, 23751, 16801, 31465, 30913, 40920, 40257, 52360, 46981, 66045, 64981, 82251, 80881, 101270, 84841, 123410, 121441
(list;
graph;
refs;
listen;
history;
text;
internal format)
|
|
|
OFFSET
|
1,5
|
|
REFERENCES
|
N. J. A. Sloane and Simon Plouffe, The Encyclopedia of Integer Sequences, Academic Press, 1995 (includes this sequence).
|
|
LINKS
|
N. J. A. Sloane, Three (No, 8) Lovely Problems from the OEIS, Experimental Mathematics Seminar, Rutgers University, Oct 05 2017, Part I, Part 2, Slides. (Mentions this sequence)
N. J. A. Sloane (in collaboration with Scott R. Shannon), Art and Sequences, Slides of guest lecture in Math 640, Rutgers Univ., Feb 8, 2020. Mentions this sequence.
|
|
FORMULA
|
Let delta(m,n) = 1 if m divides n, otherwise 0.
For n >= 3, a(n) = binomial(n,4) + (-5*n^3 + 45*n^2 - 70*n + 24)*delta(2,n)/24
- (3*n/2)*delta(4,n) + (-45*n^2 + 262*n)*delta(6,n)/6 + 42*n*delta(12,n)
+ 60*n*delta(18,n) + 35*n*delta(24,n) - 38*n*delta(30,n)
- 82*n*delta(42,n) - 330*n*delta(60,n) - 144*n*delta(84,n)
- 96*n*delta(90,n) - 144*n*delta(120,n) - 96*n*delta(210,n). [Poonen and Rubinstein, Theorem 1] - N. J. A. Sloane, Aug 09 2017
For odd n, a(n) = binomial(n,4) = n*(n-1)*(n-2)*(n-3)/24, see A053126. For even n, use this formula, but then subtract 2 for every 3-crossing, subtract 5 for every 4-crossing, subtract 9 for every 5-crossing, etc. The number to be subtracted for a d-crossing is (d-1)*(d-2)/2. - Graeme McRae, Dec 26 2004
|
|
MAPLE
|
delta:=(m, n) -> if (n mod m) = 0 then 1 else 0; fi;
f:=proc(n) global delta;
if n <= 2 then 0 else \
binomial(n, 4) \
+ (-5*n^3 + 45*n^2 - 70*n + 24)*delta(2, n)/24 \
- (3*n/2)*delta(4, n) \
+ (-45*n^2 + 262*n)*delta(6, n)/6 \
+ 42*n*delta(12, n) \
+ 60*n*delta(18, n) \
+ 35*n*delta(24, n) \
- 38*n*delta(30, n) \
- 82*n*delta(42, n) \
- 330*n*delta(60, n) \
- 144*n*delta(84, n) \
- 96*n*delta(90, n) \
- 144*n*delta(120, n) \
- 96*n*delta(210, n); fi; end;
|
|
MATHEMATICA
|
del[m_, n_]:=If[Mod[n, m]==0, 1, 0]; Int[n_]:=If[n<4, 0, Binomial[n, 4] + del[2, n](-5n^3+45n^2-70n+24)/24 - del[4, n](3n/2) + del[6, n](-45n^2+262n)/6 + del[12, n]*42n + del[18, n]*60n + del[24, n]*35n - del[30, n]*38n - del[42, n]*82n - del[60, n]*330n - del[84, n]*144n - del[90, n]*96n - del[120, n]*144n - del[210, n]*96n]; Table[Int[n], {n, 1, 1000}] (* T. D. Noe, Dec 21 2006 *)
|
|
PROG
|
(PARI) apply( {A006561(n)=binomial(n, 4)+if(n%2==0, (n>2) + (-5*n^2+45*n-70)*n/24 + vecsum([t[2] | t<-[4, 6, 12, 18, 24, 30, 42, 60, 84, 90, 120, 210; -3/2, (262-45*n)/6, 42, 60, 35, -38, -82, -330, -144, -96, -144, -96], n%t[1]==0])*n)}, [1..44]) \\ M. F. Hasler, Aug 23 2017, edited Aug 06 2021
(Python)
def d(n, m): return not n % m
def A006561(n): return 0 if n == 2 else n*(42*d(n, 12) - 144*d(n, 120) + 60*d(n, 18) - 96*d(n, 210) + 35*d(n, 24)- 38*d(n, 30) - 82*d(n, 42) - 330*d(n, 60) - 144*d(n, 84) - 96*d(n, 90)) + (n**4 - 6*n**3 + 11*n**2 - 6*n -d(n, 2)*(5*n**3 - 45*n**2 + 70*n - 24) - 36*d(n, 4)*n - 4*d(n, 6)*n*(45*n - 262))//24 # Chai Wah Wu, Mar 08 2021
|
|
CROSSREFS
|
See A290447 for an analogous problem on a line.
|
|
KEYWORD
|
easy,nonn,nice
|
|
AUTHOR
|
|
|
STATUS
|
approved
|
|
|
|