Harary Index

Author

Eric W. Weisstein
December 11, 2017

This notebook downloaded from http://mathworld.wolfram.com/notebooks/GraphTheory/HararyIndex.nb.

For more information, see Eric's MathWorld entry http://mathworld.wolfram.com/HararyIndex.html.

©2017 Wolfram Research, Inc. except for portions noted otherwise

Missing

GraphData["HararyIndex","Missing"]

Parametric families

Andrasfai

A033568(n)/2

seq=Table[GraphData[{"Andrasfai",n},"HararyIndex"],{n,10}]

FindSequenceFunction[seq,n]//Factor

Antiprism

Convert DifferenceRoot to closed form

Entity["Graph",{"Antiprism",n}]["HararyIndex"]

seq=Table[GraphData[{"Antiprism",n},"HararyIndex"],{n,3,25}]

FullSimplify[DifferenceRoot[Function[{\[FormalY],\[FormalN]},{-8 (1+\[FormalN]) (2+\[FormalN])-(1+\[FormalN]) (2+\[FormalN]) \[FormalY][\[FormalN]]+(-6-3 \[FormalN]) \[FormalY][1+\[FormalN]]+(1+\[FormalN]) (3+\[FormalN]) \[FormalY][2+\[FormalN]]==0,\[FormalY][1]==1,\[FormalY][2]==6}]][n],Mod[n,2]==0]

Entity["Graph",{"Antiprism",n}]["DistanceMatrix"]

(tallies=Table[Tally[Flatten[GraphDistanceMatrix[AntiprismGraph[n]]]],{n,3,15}])//Column

FindSequenceFunction[tallies[[All,2,2]],n-2]

FindSequenceFunction[tallies[[;;All;;2,-1,-1]],(n-1)/2]//Factor

FindSequenceFunction[tallies[[2;;All;;2,-1,-1]],n/2-1]//Factor

(tallies2=Table[Join[{{0,2n}},Table[{k,8n},{k,Floor[(n-1)/2]}],If[Mod[n,2]==0,{{n/2,6n}},{{(n+1)/2,2n}}]],{n,3,15}])//Column

tallies===tallies2

FullSimplify[Sum[((8n)/k),{k,Floor[(n-1)/2]}]+If[Mod[n,2]==0, ((6n)/(n/2)),((2n)/((n+1)/2))],n∈Integers&&Mod[n,2]==#]&/@{0,1}

FullSimplify[(EulerGamma+PolyGamma[0,n])]

FullSimplify[EulerGamma+PolyGamma[0,n]-HarmonicNumber[n-1]]

Table[12+8 n (EulerGamma+PolyGamma[0,(n/2)]),{n,2,10,2}]

Table[12+8 n HarmonicNumber[(n/2)-1],{n,2,10,2}]//FunctionExpand//FullSimplify

({{\[Piecewise], ({{2 (2 n (HarmonicNumber[(n/2)-1])+3), (Mod[n, 2])==0}, {2 n (2 (HarmonicNumber[((n-1)/2)])+(1/(n+1))), (Mod[n, 2])==1}})}})

Table[Piecewise[{
{2(3+2 n HarmonicNumber[(n/2)-1]),Mod[n,2]==0},
{2 n ((1/(n+1))+2 HarmonicNumber[((n-1)/2)]),Mod[n,2]==1}
}],{n,3,30}]//FullSimplify

(seq=Table[HararyIndex[AntiprismGraph[n]],{n,3,30}])//Timing

FindSequenceFunction[seq,n-2]

FindSequenceFunction[Rest@seq,n-3]

TimeConstrained[FunctionExpand[%],60]//Timing

bug(343587): FunctionExpand[DifferenceRoot[...]] hangs

TimeConstrained[RSolve[{-8 (3+\[FormalN]) (4+\[FormalN])-(3+\[FormalN]) (4+\[FormalN]) \[FormalY][\[FormalN]]+(-12-3 \[FormalN]) \[FormalY][1+\[FormalN]]+(3+\[FormalN]) (5+\[FormalN]) \[FormalY][2+\[FormalN]]==0,\[FormalY][1]==(27/2),\[FormalY][2]==22},\[FormalY][\[FormalN]],\[FormalN]],60]//Timing

Through[{Numerator,Denominator}[seq]]

(neither in OEIS)

Apollonian

(tallies=Table[Tally[Flatten[GraphDistanceMatrix[ApollonianGraph[n]]]],{n,8}])//Column

Not in OEIS

tallies[[All,2;;,2]]/2//Column

FindSequenceFunction[tallies[[All,2,2]],n]

FindSequenceFunction[tallies[[2;;,3,2]],n]

{12,144,1044,5940,29676,130272}/12

seq=Table[GraphData[{"Apollonian",n},"HararyIndex"],{n,6}]

(seq=Table[HararyIndex[ApollonianGraph[n]],{n,8}])//Timing

FindSequenceFunction[seq,n]//Head//Timing

FindSequenceFunction[Rest@seq,n-1]//Head//Timing

Bishop n×n

A296197

seq=Table[GraphData[{"Bishop",{n,n}},"HararyIndex"],{n,10}]

(seq=Table[HararyIndex[BishopGraph[n,n]],{n,20}])//Timing

FindSequenceFunction[seq,n]//FullSimplify

Factor[3+2 n (4+n (-18+n (8+3 n)))]

(1/48) (6 (n^4)+16 (n^3)-36 (n^2)+8 n-3 (((-1))^n)+3)

Table[(3+8 n-36 (n^2)+16 (n^3)+6 (n^4)-3(((-1))^n))/48,{n,10}]

FindLinearRecurrence[seq]

LinearRecurrence[{4,-5,0,5,-4,1},{0,2,13,42,102,208},40]

gf=x FindGeneratingFunction[seq,x]

CoefficientList[Series[((x(-2-5 x+(x^3)))/((((-1+x))^5) (1+x))),{x,0,20}],x]

BlackBishop n×n

A296198

seq=Table[GraphData[{"BlackBishop",{n,n}},"HararyIndex"],{n,10}]

FindSequenceFunction[seq,n]//Factor

(seq=Table[HararyIndex[BlackBishopGraph[n,n]],{n,20}])//Timing

FindSequenceFunction[seq,n]

coef=FindLinearRecurrence[seq]

Take[seq,Length@coef]

LinearRecurrence[{2,2,-6,0,6,-2,-2,1},{0,1,8,21,55,104,197,318},40]

gf=x FindGeneratingFunction[seq,x]

FullSimplify[SeriesCoefficient[(((x^2) (-1-6 x-3 (x^2)-3 (x^3)+(x^5)))/((((-1+x))^5) (((1+x))^3))),{x,0,n}],n>0&&n∈Integers]//FullSimplify

Factor[ (-5+2 n (2+n))]

(1/96) (6 (n^4)+16 (n^3)-30 (n^2)-3 (((-1))^n) (2 (n^2)+4 n-5)+20 n-15)

Table[(-15+20 n-30 (n^2)+16 (n^3)+6 (n^4)-3 (((-1))^n) (2 (n^2)+4n-5))/96,{n,20}]

CoefficientList[Series[((x(-1-6 x-3 (x^2)-3 (x^3)+(x^5)))/((((-1+x))^5) (((1+x))^3))),{x,0,20}],x]

Bruhat

seq=Table[GraphData[{"Bruhat",n},"HararyIndex"],{n,6}]

CocktailParty

seq=Table[GraphData[{"CocktailParty",n},"HararyIndex"],{n,20}]

FindSequenceFunction[Rest@seq,n-1]//Factor

Complete

Entity["Graph",{"Complete",n}]["HararyIndex"]

Table[HararyIndex[System`CompleteGraph[n]],{n,20}]

Table[n(n-1)/2,{n,20}]

CompleteBipartite m×n

Entity["Graph",{"CompleteBipartite",{m,n}}]["HararyIndex"]

CompleteBipartite n×n

A000326

Entity["Graph",{"CompleteBipartite",{n,n}}]["HararyIndex"]

seq=Table[GraphData[{"CompleteBipartite",{n,n}},"HararyIndex"],{n,20}]

FindSequenceFunction[seq,n]

CompleteTripartite k×m×n

Entity["Graph",{"CompleteTripartite",{k,m,n}}]["HararyIndex"]

CompleteTripartite n×n×n

Entity["Graph",{"CompleteTripartite",{n,n,n}}]["HararyIndex"]

seq=Table[GraphData[{"CompleteTripartite",{n,n,n}},"HararyIndex"],{n,10}]

FindSequenceFunction[seq,n]//Factor

CrossedPrism

seq=Table[GraphData[{"CrossedPrism",2n},"HararyIndex"],{n,2,10}]

FindSequenceFunction[seq,n-1]//FullSimplify

Table[(EulerGamma+PolyGamma[0,n]),{n,10}]

FullSimplify[EulerGamma+PolyGamma[0,n]]

bug(343626): FullSimplify[EulerGamma + PolyGamma[0, n]] should return HarmonicNumber[n - 1]

FunctionExpand[%]

FullSimplify[EulerGamma+PolyGamma[0,n]-HarmonicNumber[n-1]]

FullSimplify[4-(n/3)+8 n HarmonicNumber[n-1]]

Table[4+(8HarmonicNumber[n-1]-(1/3))n,{n,2,10}]

Crown

seq=Table[GraphData[{"Crown",n},"HararyIndex"],{n,3,20}]

FindSequenceFunction[seq,n-2]//Factor

CubeConnectedCycle

Entity["Graph",{"CubeConnectedCycle",n}]["HararyIndex"]

Entity["Graph",{"CubeConnectedCycle",n}]["DistanceMatrix"]

(tallies=Table[Tally[Flatten[GraphDistanceMatrix[CubeConnectedCycleGraph[n]]]],{n,3,9}])//Column

tallies[[All,2;;,2]]/2//Column

FindSequenceFunction[tallies[[2,All,2]]]

FindSequenceFunction[tallies[[All,2,2]],n]

FindSequenceFunction[tallies[[All,3,2]],n]

seq=Table[GraphData[{"CubeConnectedCycle",n},"HararyIndex"],{n,3,8}]

(seq=Table[HararyIndex[CubeConnectedCycleGraph[n]],{n,3,9}])//Timing

Do[Print[{{"CubeConnectedCycle",n},HararyIndex[CubeConnectedCycleGraph[n]]//Timing}],{n,3,10}]

seq={(556/5),(57376/105),(162634/63),(34149904/3003),(323818864/6435),(166454474752/765765),(43636648384/46189),(20869949213056/5148297),(379107322869824/21729825)};

FindSequenceFunction[seq,n-2]//Head//Timing

FindSequenceFunction[Rest@seq,n-3]//Head//Timing

Cycle

Entity["Graph",{"Cycle",n}]["HararyIndex"]

A160046/A160047

seq=Table[GraphData[{"Cycle",n},"HararyIndex"],{n,3,20}]

seq=Table[HararyIndex[CycleGraph[n]],{n,3,20}]

FindSequenceFunction[seq,n-2]

Through[{Numerator,Denominator}[seq]]

1+n Sum[(1/k),{k,(n-2)/2}]

n Sum[(1/k),{k,(n-1)/2}]

Table[Piecewise[{
{1+n HarmonicNumber[(1/2) (n-2)],Mod[n,2]==0},
{n HarmonicNumber[(1/2) (n-1)],Mod[n,2]==1}
}],{n,3,20}]

Table[Floor[((n-1)/2)],{n,10}]

n (HarmonicNumber[(Floor[((n-1)/2)])])+(1/2) ((((-1))^n)+1)

Table[(1+(((-1))^n))/2+n HarmonicNumber[Floor[((n-1)/2)]],{n,3,20}]

Table[(1+(((-1))^n))/2+n HarmonicNumber[Floor[((n-1)/2)]],{n,3,20}]

Table[1-Mod[n,2]+n HarmonicNumber[Floor[((n-1)/2)]],{n,3,20}]

Numerator[Table[1-Mod[n,2]+n HarmonicNumber[Floor[((n-1)/2)]],{n,20}]]

Denominator[Table[1-Mod[n,2]+n HarmonicNumber[Floor[((n-1)/2)]],{n,20}]]

DiagonalIntersection

seq=Table[GraphData[{"DiagonalIntersection",n},"HararyIndex"],{n,3,14}]

Dipyramid

seq=Table[GraphData[{"Dipyramid",n},"HararyIndex"],{n,3,20}]

Empty

Entity["Graph",{"Empty",n}]["HararyIndex"]

Table[HararyIndex[EmptyGraph[n]],{n,20}]

FibonacciCube

seq=Table[GraphData[{"FibonacciCube",n},"HararyIndex"],{n,15}]

(seq=Table[HararyIndex[FibonacciCubeGraph[n]],{n,10}])//Timing

(tallies=Table[Tally[Flatten[GraphDistanceMatrix[FibonacciCubeGraph[n]]]],{n,12}])//Column

A246173

tallies[[All,2;;,2]]/2//Column

Rest/@Rest[CoefficientList[CoefficientList[Series[t z/((1-z-z^2-t z-t z^2+t z^3)(1-z-z^2)),{z,0,10},{t,0,5}],z],t]]//Flatten

CoefficientList[Series[t z/((1-z-z^2-t z-t z^2+t z^3)(1-z-z^2)),{z,0,10}],{z,t}]//Column

DeleteCases[CoefficientList[Series[t z/((1-z-z^2-t z-t z^2+t z^3)(1-z-z^2)),{z,0,10}],{z,t}]//Flatten,0]

(coef=SeriesCoefficient[t z/((1-z-z^2-t z-t z^2+t z^3)(1-z-z^2)),{z,0,n},{t,0,k}])//Timing

bug(343901): It would be better if SeriesCoefficient[t z/((1 - z - z^2 - t z - t z^2 + t z^3) (1 - z - z^2)), {z, 0, n}, {t, 0, k}]) didn't take 7.7 hours to return unevaluated

SeriesCoefficient[t z/((1-z-z^2-t z-t z^2+t z^3)(1-z-z^2)),{t,0,k},{z,0,n}]

FullSimplify[SeriesCoefficient[t z/((1-z-z^2-t z-t z^2+t z^3)(1-z-z^2)),{z,0,n}],n∈Integers&&n>0]

Table[

Do[Print[{{"FibonacciCube",n},MemoryConstrained[HararyIndex[FibonacciCubeGraph[n]],120*^9]//Timing}],{n,30}]

seq={1,(5/2),(22/3),(71/4),(216/5),(1219/12),(25033/105),(4457/8),(411224/315),(73687/24),(8385416/1155),(103603/6),(53172283/1287),(16704503/168),(240867442/1001),(196666711/336),(219081629440/153153),(3539025661/1008),(762793148015/88179),(855521877/40),(154362546039392/2909907)};

FindSequenceFunction[seq,n]//Head//Timing

FindSequenceFunction[Rest@seq,n-1]//Head//Timing

FindSequenceFunction[seq[[;;;;2]],n]//Head//Timing

FindSequenceFunction[seq[[3;;;;2]],n]//Head//Timing

FindSequenceFunction[seq[[2;;;;2]],n]//Head//Timing

FoldedCube

seq=Table[GraphData[{"FoldedCube",n},"HararyIndex"],{n,2,10}]

(seq=Table[HararyIndex[FoldedCubeGraph[n]],{n,2,13}])//Timing

(tallies=Table[Tally[Flatten[GraphDistanceMatrix[FoldedCubeGraph[n]]]],{n,2,13}])//Column

Not in OEIS :

(t1=tallies[[All,All,2]]/2)//Column

FindSequenceFunction[Rest@{1024,12288,67584,225280,506880,811008,473088},n]

FindSequenceFunction[Rest@{2048,26624,159744,585728,1464320,2635776,3514368},n]

(2^(n-2))Binomial[n,k-1]/.k->Floor[n/2]+1

Table[Join[Table[(2^(n-2))Binomial[n,k-1],{k,Floor[n/2]}],{(2^(-2+n)) Binomial[n,Floor[(n/2)]]/If[Mod[n,2]==1,1,2]}],{n,2,13}]//Column

Table[Sum[(((2^(n-2))Binomial[n,k-1])/(k-1)),{k,2,n/2}]+(((2^(-2+n)) Binomial[n,(n/2)])/(n/2))/2,{n,2,10,2}]

FullSimplify[Sum[(((2^(n-2))Binomial[n,k-1])/(k-1)),{k,2,n/2}]+(((2^(-2+n)) Binomial[n,(n/2)])/(n/2))/2,n∈Integers&&n>1]

Table[Sum[(((2^(n-2))Binomial[n,k-1])/(k-1)),{k,2,((n-1)/2)}]+(((2^(-2+n)) Binomial[n,((n-1)/2)])/((n-1)/2)),{n,1,10,2}]

FullSimplify[Sum[(((2^(n-2))Binomial[n,k-1])/(k-1)),{k,2,((n-1)/2)}]+(((2^(-2+n)) Binomial[n,((n-1)/2)])/((n-1)/2)),n∈Integers&&n>1]

({{\[Piecewise], ({{(((2^(n-2)) ((Binomial[n, (n/2)]) (1-2 (Subscript[, 3])(Subscript[F, 2])(1,-(n/2),(n/2);(n/2)+1,(n/2)+1;-1))+(n^2) (Subscript[, 3])(Subscript[F, 2])(1,1,1-n;2,2;-1)))/n), (Mod[n, 2])==0}, {(((2^(n-2)) ((n-1) n (Subscript[, 3])(Subscript[F, 2])(1,1,1-n;2,2;-1)-2 (Binomial[n, ((n-1)/2)]) ((Subscript[, 3])(Subscript[F, 2])(1,-(n/2)-(1/2),(n/2)-(1/2);(n/2)+(1/2),(n/2)+(1/2);-1)-1)))/(n-1)), (Mod[n, 2])==1}})}})

Table[Piecewise[{
{(((2^(-2+n)) ((n^2) HypergeometricPFQ[{1,1,1-n},{2,2},-1]+Binomial[n,(n/2)] (1-2 HypergeometricPFQ[{1,-(n/2),(n/2)},{1+(n/2),1+(n/2)},-1])))/n),Mod[n,2]==0},
{(1/(-1+n))(2^(-2+n)) ((-1+n) n HypergeometricPFQ[{1,1,1-n},{2,2},-1]-2 Binomial[n,(1/2) (-1+n)] (-1+HypergeometricPFQ[{1,-(1/2)-(n/2),-(1/2)+(n/2)},{(1/2)+(n/2),(1/2)+(n/2)},-1])),Mod[n,2]==1}}],{n,2,20}]

Do[Print[{{"FoldedCube",n},MemoryConstrained[HararyIndex[FoldedCubeGraph[n]],120*^9]//Timing}],{n,20}]

seq={0,1,6,22,80,(808/3),(2800/3),(9488/3),11072,(192256/5),(687104/5),(7334144/15),(26710528/15),(678290432/105),(2506909696/105),(9228818432/105)};

FindSequenceFunction[seq,n-1]//Head//Timing

FindSequenceFunction[Rest@seq,n-2]//Head//Timing

FindSequenceFunction[seq[[;;;;2]]]//Head//Timing

FindSequenceFunction[seq[[3;;;;2]]]//Head//Timing

FindSequenceFunction[seq[[2;;;;2]]]//Head//Timing

Gear

seq=Table[GraphData[{"Gear",n},"HararyIndex"],{n,3,20}]

FindSequenceFunction[seq,n-2]//Factor

Grid m×n

Entity["Graph",{"Grid",{m,n}}]["HararyIndex"]

Grid n×n

Entity["Graph",{"Grid",{n,n}}]["HararyIndex"]

A296191/A296192

seq=Table[GraphData[{"Grid",{n,n}},"HararyIndex"],{n,10}]

Through[{Numerator,Denominator}[seq]]

(seq=Table[HararyIndex[System`GridGraph[{n,n}]],{n,20}])//Timing

FindSequenceFunction[seq,n]//FullSimplify

Table[n (2 n+1) (2+(2 n-1) (HarmonicNumber[n-(3/2)]- HarmonicNumber[n]+2Log[2])-n)/3,{n,20}]//FunctionExpand//FullSimplify

(1/3) n (2 n+1) ((2 n-1) ((HarmonicNumber[n-(3/2)])-(HarmonicNumber[n])+2 log(2))-n+2)

FullSimplify[n (2 n+1) (2+(2 n-1) (HarmonicNumber[n-(3/2)]- HarmonicNumber[n]+2Log[2])-n)/3,n∈Integers&&n>0]

Table[n (2 n+1) (2+(2 n-1) (HarmonicNumber[n-(3/2)]- HarmonicNumber[n]+2Log[2])-n)/3,{n,20}]//FunctionExpand//FullSimplify//Numerator

Through[{Numerator,Denominator}[seq]]

Table[HarmonicNumber[n-(3/2)]- HarmonicNumber[n]+2Log[2],{n,10}]//FullSimplify

Table[((CatalanNumber'[n-1])/(CatalanNumber[n-1])),{n,10}]//FullSimplify

CatalanNumber'[n]//FunctionExpand//FullSimplify

D[Log[CatalanNumber[n-1]],n]//FullSimplify

(1/3) n (2 n+1) ((2 n-1) ((log((CatalanNumber[#1-1]))&))'(n)-n+2)

n (2 n+1) (2+(2 n-1)Derivative[1][Log[CatalanNumber[#-1]]&][n]-n)/3

Table[n (2 n+1) (2+(2 n-1)Derivative[1][Log[CatalanNumber[#-1]]&][n]-n)/3,{n,20}]//FullSimplify//Numerator

Grid k×m×n

Entity["Graph",{"Grid",{k,m,n}}]["HararyIndex"]

Grid n×n×n

Entity["Graph",{"Grid",{n,n,n}}]["HararyIndex"]

seq=Table[GraphData[{"Grid",{n,n,n}},"HararyIndex"],{n,10}]

(seq=Table[HararyIndex[System`GridGraph[{n,n,n}]],{n,15}])//Timing

(tallies=Table[Tally[Flatten[GraphDistanceMatrix[System`GridGraph[{n,n,n}]]]],{n,8}])//Column

Not in OEIS

tallies[[All,2;;,2]]/2//Column

FindSequenceFunction[tallies[[All,2,2]],n]

Do[Print[{{"Grid",{n,n,n}},MemoryConstrained[HararyIndex[System`GridGraph[{n,n,n}]],120*^9]//Timing}],{n,40}]

seq={0,(58/3),(2402/15),(30617/45),(7168769/3465),(10984859/2145),(29211869/2652),(20744815033/969969),(17137338731041/446185740),(59195938697999/912652650),(2758245765385217/26466926850),(10625365705613053/66118842900),(332394436601785807/1388495700900),(1501721043994598309/4336795013850),(8914437334290065983231/18255015811632600),(897205413277779440959/1331955339197175),(5932992800719701696741101/6510597697995791400),(392165920727816779257017/323626201362363900),(6804368349573124332521537/4288047168051321675),(379081389624914045896215661/184965494059727280900),(150798095506249446334834944559/57682810504626379172100),(21400085000725925808864645629/6490266162180622900260),(839603838860578253835787864319/203979793668533862579600),(240000855764117759943435104002879/47149929306481602335274540),(83563939145220385345912945026684001/13390579923040775063217969360),(1664601444180386414570814266902804781/219313664765187053118730203300),(6531557255118013414026019415015188223/712769410486857922635873160725),(658347338854229311407418676518752923867/59914764633240116216051919283800),(7011481591933601375359524567380008926487/535545819260192423408094847752120),(84163812263715268441788194089528618162459/5427440157556251172711068752756700),(3921569597864657736257408285299120813291/214693362282679960459847454644400),(6868129622880210024308800425306574289236313/320878015600664935403782257618337185),(7994762313801579766265911041857793340328911/320306040528292983647269276766967600),(163219676852864562751999845184869852347469911/5633514482038823300301697554566281800),(2105400501127461138157949228169457211450384887457/62872838376794287443017095557736988028900),(1678866263631699096832612110676762442418842779/43554656691247652624387618362686828600),(980005803248741488297569511832450981956484686175/22172222671868116763002982096989819623864),(112301441056915365982070795596751058156836497902253/2223877781106244615918573830120229918652904),(4575307789031589966656135058867475385850374321631819329/79577759933918453172952966887802227255796414800),(8643076957426670111598296007201694046115655958682987061/132467856475364254367171707075426878297758666100),(5587337920720634138200795823428277688471804184292436173/75695917985922431066955261185958216170147809200),(5268800642331452142745887246697929816000744258201695351/63284032546033228938854912494698131179660141800),(2044500119768998438514022298963375855277038634881334486477/21832991228381463983904944810670855256982748921000),(15939639995616660646417373542688339247565872880014123784611733/151747228306788767947769877323184506165214462364194000)};

Do[Print[{k,FindSequenceFunction[Drop[seq,k],n-k]//Head//Timing}],{k,0,3}]

FindSequenceFunction[seq[[;;;;2]]]//Head//Timing

FindSequenceFunction[seq[[3;;;;2]]]//Head//Timing

FindSequenceFunction[seq[[2;;;;2]]]//Head//Timing

HalvedCube

seq=Table[GraphData[{"HalvedCube",n},"HararyIndex"],{n,10}]

(seq=Table[HararyIndex[HalvedCubeGraph[n]],{n,12}])//Timing

FindSequenceFunction[seq,n]//Head//Timing

FindSequenceFunction[Rest@seq,n-1]//Head//Timing

(tallies=Table[Tally[Flatten[GraphDistanceMatrix[HalvedCubeGraph[n]]]],{n,10}])//Column

Not in OEIS

tallies[[All,2;;,2]]/2//Column

-(2^(n-1)) (HarmonicNumber[n])-(2^(2 n-1)) Re((LerchPhi[2, 1, n+1]))

Sum[(((2^(n-1))Binomial[n,k])/k),{k,n}]

-(2^(n-1)) (HarmonicNumber[n])-(4^n) Re((LerchPhi[2, 1, n+1]))-(-(2^(n-1)) (HarmonicNumber[n])-(2^(2 n-1)) Re((LerchPhi[2, 1, n+1])))//FullSimplify

It appears there is no simpler way to express the LerchPhi?

A242376/A241519

seq=Table[-Re[LerchPhi[2,1,n+1]],{n,0,50}]

RSolve[{b[n]==b[n-1]/2+1/(2*n),b[0]==0},b[n],n]

RecurrenceTable[{b[n]==b[n-1]/2+1/(2*n),b[0]==0},b[n],{n,20}]

FindSequenceFunction[seq,n]

-Re[LerchPhi[2,1,Range[20]]]//Numerator

Table[-2^(n-1)HarmonicNumber[n]-2^(2n-1)Re[LerchPhi[2,1,n+1]],{n,20}]

Table[(2^(-1+n)) n HypergeometricPFQ[{1,1,1-n},{2,2},-1],{n,20}]

Hanoi

Not in OEIS

seq=Table[GraphData[{"Hanoi",n},"HararyIndex"],{n,5}]

(seq=Table[HararyIndex[HanoiGraph[n]],{n,7}])//Timing

(tallies=Table[Tally[Flatten[GraphDistanceMatrix[HanoiGraph[n]]]],{n,7}])//Column

tallies[[All,2;;,2]]/2//Column

FindSequenceFunction[seq,n]//Head//Timing

Helm

seq=Table[GraphData[{"Helm",n},"HararyIndex"],{n,3,20}]

FindSequenceFunction[seq,n-2]//Factor

Hypercube

Entity["Graph",{"Hypercube",n}]["HararyIndex"]

seq=Table[GraphData[{"Hypercube",n},"HararyIndex"],{n,10}]

(seq=Table[HararyIndex[HypercubeGraph[n]],{n,11}])//Timing

(tallies=Table[Tally[Flatten[GraphDistanceMatrix[HypercubeGraph[n]]]],{n,10}])//Column

A143376

tallies[[All,2;;,2]]/2//Column

Table[Sum[(((2^(n-1))Binomial[n,k])/k),{k,n}],{n,10}]

Sum[(((2^(n-1))Binomial[n,k])/k),{k,n}]

Table[(2^(-1+n)) n HypergeometricPFQ[{1,1,1-n},{2,2},-1],{n,0,20}]

FullSimplify[%]

FunctionExpand[%]

Table[(2^(-1+n)) n HypergeometricPFQ[{1,1,1-n},{2,2},-1],{n,10}]

Simplify`SimplifyCount/@{
-(2^(-1+n)) HarmonicNumber[n]-(4^n) Re[LerchPhi[2,1,1+n]],
(2^(-1+n)) n HypergeometricPFQ[{1,1,1-n},{2,2},-1]
}

And@@Equal@@@Table[{
-(2^(-1+n)) HarmonicNumber[n]-(4^n) Re[LerchPhi[2,1,1+n]],
(2^(-1+n)) n HypergeometricPFQ[{1,1,1-n},{2,2},-1]
},{n,10}]

FullSimplify[FunctionExpand@Subtract@@{
-(2^(-1+n)) HarmonicNumber[n]-(4^n) Re[LerchPhi[2,1,1+n]],
(2^(n-1)) n HypergeometricPFQ[{1,1,1-n},{2,2},-1]
},n∈Integers]

FunctionExpand[(2^(-1+n)) n HypergeometricPFQ[{1,1,1-n},{2,2},-1]]

bug(343839): FullSimplify and/or FunctionExpand could show equality for -2^(-1 + n) HarmonicNumber[n] - 4^n Re[LerchPhi[2, 1, 1 + n]] and 2^(-1 + n) n HypergeometricPFQ[{1, 1, 1 - n}, {2, 2}, -1] under Element[n, Integers]

FindSequenceFunction[seq,n]//Head//Timing

FindSequenceFunction[Rest@seq,n-1]//Head//Timing

Table[-(2^(-1+n)) HarmonicNumber[n]-(4^n) Re[LerchPhi[2,1,1+n]],{n,10}]

Keller

Entity["Graph",{"Keller",n}]["HararyIndex"]

Entity["Graph",{"Keller",n}]["DistanceMatrix"]

(tallies=Table[Tally[Flatten[GraphDistanceMatrix[KellerGraph[n]]]],{n,5}])//Column

FindSequenceFunction[tallies[[2;;,2,-1]]]

FindSequenceFunction[tallies[[2;;,-1,-1]]]

A296189

seq=Table[GraphData[{"Keller",n},"HararyIndex"],{n,5}]

(seq=Table[HararyIndex[KellerGraph[n]],{n,5}])//Timing

Do[Print[{{"Keller",n},HararyIndex[KellerGraph[n]]//Timing}],{n,6}]

seq={0,80,1552,27264,460544,7634944,125227008};

Head/@Table[FindSequenceFunction[Drop[seq,k],n-k],{k,0,3}]//Union//Timing

Head/@Table[FindLinearRecurrence[Drop[seq,k]],{k,0,3}]//Union//Timing

Head/@Table[FindGeneratingFunction[Drop[seq,k],x],{k,0,3}]//Union//Timing

Table[If[n==1,0,4^n(4^n-(3^n+n+1)/2)/2],{n,20}]

FullSimplify[4^n(4^n-(3^n+n+1)/2)/2]

Table[If[n==1,0,(4^(n-1))((2^(2n+1))-(3^n)-n-1)],{n,20}]

seq=Table[(4^(n-1))((2^(2n+1))-(3^n)-n-1),{n,20}]

FindLinearRecurrence[seq]

Join[{0},LinearRecurrence[{36,-432,1984,-3072},{80,1552,27264,460544},20]]

gf=x FindGeneratingFunction[%,x]

CoefficientList[Series[-((16 x (-5+83 x-372 (x^2)+576 (x^3)))/((((-1+4 x))^2) (1-28 x+192 (x^2)))),{x,0,20}],x]

King n×n

A144945

seq=Table[GraphData[{"King",{n,n}},"HararyIndex"],{n,10}]

FindSequenceFunction[seq,n]//Factor

seq=Table[(n-1)n(5n-1)/3,{n,20}]

FindLinearRecurrence[seq]

LinearRecurrence[{4,-6,4,-1},{0,6,28,76},20]

gf=x FindGeneratingFunction[seq,x]

CoefficientList[Series[((2 x(3+2 x))/(((-1+x))^4)),{x,0,20}],x]

Knight m×n

Entity["Graph",{"Knight",{m,n}}]["HararyIndex"]

Knight n×n

Entity["Graph",{"Knight",{n,n}}]["HararyIndex"]

seq=Table[GraphData[{"Knight",{n,n}},"HararyIndex"],{n,20}]

(tallies=Table[Tally[Flatten[GraphDistanceMatrix[KnightGraph[n,n]]]],{n,10}])//Column

Not in OEIS

tallies[[All,2;;,2]]/2//Column

(seq=Table[HararyIndex[KnightGraph[n,n]],{n,50}])//Timing

Do[Print[{k,FindSequenceFunction[Drop[seq,k],n-k]//Head//Timing}],{k,2,5}]

FindSequenceFunction[seq[[4;;;;2]],n/2-2]//Head//Timing

Table[%,{n,4,20,2}]

FindSequenceFunction[seq[[3;;;;2]],(n-3)/2]//Head//Timing

Table[%,{n,3,20,2}]

Table[Piecewise[{
{XXX,Mod[n,2]==0},
{XXX,Mod[n,2]==1}}],{n,3,50}]

MengerSponge

seq=Table[GraphData[{"MengerSponge",n},"HararyIndex"],{n,3}]

(seq=Table[HararyIndex[MengerSpongeGraph[n]],{n,2}])//Timing

MoebiusLadder

Entity["Graph",{"MoebiusLadder",n}]["HararyIndex"]

seq=Table[GraphData[{"MoebiusLadder",n},"HararyIndex"],{n,3,25}]

(seq=Table[HararyIndex[MoebiusLadder[n]],{n,3,50}])//Timing

FindSequenceFunction[seq,n-2]

TimeConstrained[FunctionExpand[%],60]//Timing

bug(343587): FunctionExpand[DifferenceRoot[...]] hangs

FullSimplify[FindSequenceFunction[seq[[2;;;;2]],n/2-1]]

Table[%,{n,4,20,2}]

FullSimplify[FindSequenceFunction[seq[[;;;;2]],(n-1)/2]]

Table[%,{n,3,20,2}]

({{\[Piecewise], ({{n (4 (HarmonicNumber[(n/2)])-1), (Mod[n, 2])==0}, {n (4 (HarmonicNumber[((n-1)/2)])-((n-3)/(n+1))), (Mod[n, 2])==1}})}})

Table[Piecewise[{
{n (4 HarmonicNumber[(n/2)]-1),Mod[n,2]==0},
{n(4 HarmonicNumber[((n-1)/2)]-((n-3)/(n+1))),Mod[n,2]==1}}],{n,3,50}]

Mycielski

A296193/(1 or 2)

Entity["Graph",{"Mycielski",n}]["HararyIndex"]

seq=Table[GraphData[{"Mycielski",n},"HararyIndex"],{n,11}]

(seq=Table[HararyIndex[MycielskiGraph1[n]],{n,12}])//Timing

FindSequenceFunction[seq,n]

FindSequenceFunction[Rest@seq,n-1]//FullSimplify

numer=Table[If[n==1,0,(3/4)-15 (2^(-4+n))+((7 (3^(-2+n)))/4)+9 (4^(-3+n))],{n,30}]//Numerator

FindLinearRecurrence[Rest@numer]

FindSequenceFunction[Rest@numer,n-1]

FindSequenceFunction[2Rest@numer,n-1]

denom=Table[If[n==1,0,(3/4)-15 (2^(-4+n))+((7 (3^(-2+n)))/4)+9 (4^(-3+n))],{n,30}]//Denominator

FullSimplify[1+(1+(-1)^n)/2]

Table[((3/4)-15 (2^(-4+n))+((7 (3^(-2+n)))/4)+9 (4^(-3+n)))((3+(-1)^n)/2),{n,20}]

FullSimplify[((3/4)-15 (2^(-4+n))+((7 (3^(-2+n)))/4)+9 (4^(-3+n)))((3+(-1)^n)/2),n>3]

Join[{0,1,15},Table[(((3+(((-1))^n)) (432-135 (2^(2+n))+112 (3^n)+81 (4^n)))/1152),{n,4,20}]]

numer4=Table[((3+(-1)^n) (432-135 2^(n+2)+112 3^n+81 4^n))/1152,{n,4,20}];

FindLinearRecurrence[numer4]

Join[{0,1,15},LinearRecurrence[{0,30,0,-273,0,820,0,-576},{75,162,1317,2610,20505,40212,315957,622350},20]]

gf=x FindGeneratingFunction[%,x]

Series[gf,{x,0,10}]

CoefficientList[Series[((x (1+15 x+45 (x^2)-288 (x^3)-660 (x^4)+1845 (x^5)+650 (x^6)-6162 (x^7)-576 (x^8)+4320 (x^9)))/(1-30 (x^2)+273 (x^4)-820 (x^6)+576 (x^8))),{x,0,20}],x]

Odd

Entity["Graph",{"Odd",n}]["HararyIndex"]

seq=Table[GraphData[{"Odd",n},"HararyIndex"],{n,7}]

(tallies=Table[Tally[Flatten[GraphDistanceMatrix[OddGraph1[n]]]],{n,5}])//Column

Not in OEIS:

tallies[[All,2;;,2]]/2//Column

(seq=Table[HararyIndex[OddGraph1[n]],{n,7}])//Timing

seq={0,3,30,280,2730,(57057/2),(635635/2),(7465887/2),(91354549/2)};

2seq

FindSequenceFunction[2seq,n]//Head//Timing

FindSequenceFunction[2Rest@seq,n-1]//Head//Timing

FindLinearRecurrence[2Rest@seq]//Head//Timing

FindGeneratingFunction[2seq,x]//Head//Timing

Pan

seq=Table[GraphData[{"Pan",n},"HararyIndex"],{n,3,20}]

(seq=Table[HararyIndex[PanGraph[n]],{n,3,40}])//Timing

FindSequenceFunction[seq,n-2]

FullSimplify[FindSequenceFunction[seq[[2;;;;2]],n/2-1]]

Table[%,{n,4,20,2}]

FullSimplify[FindSequenceFunction[seq[[;;;;2]],(n-1)/2]]

Table[%,{n,3,20,2}]

({{\[Piecewise], ({{(n+2) (HarmonicNumber[(n/2)])+(2/(n+2))-2, (Mod[n, 2])==0}, {(n+2) (HarmonicNumber[((n-1)/2)])+(4/(n+1))-1, (Mod[n, 2])==1}})}})

Table[Piecewise[{
{-2+(2/(2+n))+(2+n) HarmonicNumber[(n/2)],Mod[n,2]==0},
{-1+(4/(1+n))+(2+n) HarmonicNumber[(1/2) (-1+n)],Mod[n,2]==1}}],{n,3,40}]

TimeConstrained[RSolve[{-2116-1640 \[FormalN]-444 (\[FormalN]^2)-50 (\[FormalN]^3)-2 (\[FormalN]^4)-(3+\[FormalN]) (232+116 \[FormalN]+19 (\[FormalN]^2)+(\[FormalN]^3)) \[FormalY][\[FormalN]]+(-408-220 \[FormalN]-38 (\[FormalN]^2)-2 (\[FormalN]^3)) \[FormalY][1+\[FormalN]]+(6+\[FormalN]) (134+81 \[FormalN]+16 (\[FormalN]^2)+(\[FormalN]^3)) \[FormalY][2+\[FormalN]]==0,\[FormalY][1]==5,\[FormalY][2]==(22/3)},\[FormalY][\[FormalN]],\[FormalN]],60]//Timing

Path

Entity["Graph",{"Path",n}]["HararyIndex"]

seq=Table[GraphData[{"Path",n},"HararyIndex"],{n,20}]

FindSequenceFunction[seq,n]//FullSimplify

Table[2 n (-1+HarmonicNumber[n]),{n,20}]

PermutationStar

Express Whitney numbers in closed form?

A296190/A296057

seq=Table[GraphData[{"PermutationStar",n},"HararyIndex"],{n,6}]

(seq=Table[HararyIndex[PermutationStarGraph[n]],{n,6}])//Timing

Do[Print[{{"PermutationStar",n},HararyIndex[PermutationStarGraph[n]]//Timing}],{n,7}]

seq={0,1,10,123,2202,59040,2287680,121394000};

Head/@Table[FindLinearRecurrence[Drop[seq,k]],{k,0,3}]//Union//Timing

Head/@Table[FindSequenceFunction[Drop[seq,k],n-k],{k,0,3}]//Union//Timing

Head/@Table[FindGeneratingFunction[Drop[seq,k],x],{k,0,3}]//Union//Timing

(tallies=Table[Tally[Flatten[GraphDistanceMatrix[PermutationStarGraph[n]]]],{n,6}])//Column

Not in OEIS

tallies[[All,2;;,2]]/2//Column

Variant of A007799

tallies[[All,2;;,2]]/Range[6]!//Column

A007799(n,k) are Whitney numbers

(∑_(k=0)^(min(n-1,i+1)))(∑_(t=max(0,(Ceiling[(1/2) (i-2 k)])))^(min(-k+n-1,(Floor[(1/2) (i-k+1)]))))(((-1))^(i-t+2)) (Binomial[n-1, k]) (Binomial[-k+n-1, t]) (StirlingS1[k+1, i-k-2 t+1])

Table[Sum[Binomial[n-1,k]Binomial[n-1-k,t]StirlingS1[k+1,i-k+1-2t](((-1))^(i+2-t)),{k,0,Min[n-1,i+1]},{t,Max[0,Ceiling[(i-2k)/2]],Min[n-1-k,Floor[(i+1-k)/2]]}],{n,9},{i,0,Floor[3(n-1)/2]}]//Column

nmax=9;a[n_,0]=1;a[n_,1]=n-1;a[n_,2]=(n-1)(n-2);a[n_,k_/;k≥2]:=a[n,k]=(n-1)a[n-1,k-1]+Sum[j*a[j,k-3],{j,1,n-2}];Flatten[Table[a[n,k],{n,1,nmax},{k,0,Floor[3(n-1)/2]}]]

Clear[a]

a[n_,i_]:=Sum[Binomial[n-1,k]Binomial[n-1-k,t]StirlingS1[k+1,i-k+1-2t](((-1))^(i+2-t)),{k,0,Min[n-1,i+1]},{t,Max[0,Ceiling[(i-2k)/2]],Min[n-1-k,Floor[(i+1-k)/2]]}]

(n!/2)*Sum_{k=1..floor(3*(n-1)/2)} A007799(n,k)/k.

Table[n!Sum[((a[n,k])/k),{k,Floor[((3(n-1))/2)]}]/2,{n,20}]

Table[n!Sum[((a[n,k])/k),{k,((3(n-1))/2)}]/2,{n,20}]

Prism

Entity["Graph",{"Prism",n}]["HararyIndex"]

seq=Table[GraphData[{"Prism",n},"HararyIndex"],{n,3,25}]

(seq=Table[HararyIndex[PrismGraph[n]],{n,3,40}])//Timing

FindSequenceFunction[seq,n-2]

FullSimplify[FindSequenceFunction[seq[[;;;;2]],(n-1)/2]]

Table[%,{n,3,20,2}]

FullSimplify[FindSequenceFunction[seq[[2;;;;2]],n/2-1]]

Table[%,{n,4,20,2}]

({{\[Piecewise], ({{4 (n (HarmonicNumber[(n/2)-1])-(1/(n+2))+2)-n, (Mod[n, 2])==0}, {n (4 (HarmonicNumber[((n-1)/2)])-((n-3)/(n+1))), (Mod[n, 2])==1}})}})

Table[Piecewise[{
{4(n HarmonicNumber[(n/2)-1]-(1/(n+2))+2)-n,Mod[n,2]==0},
{n(4 HarmonicNumber[((n-1)/2) ]-((n-3)/(n+1))),Mod[n,2]==1}}],{n,3,40}]

Table[Piecewise[{
{n(4 HarmonicNumber[(n/2)-1]-1)-(4/(n+2))+8,Mod[n,2]==0},
{n(4 HarmonicNumber[((n-1)/2) ]-((n-3)/(n+1))),Mod[n,2]==1}}],{n,3,40}]

Queen n×n

A296196

seq=Table[GraphData[{"Queen",{n,n}},"HararyIndex"],{n,10}]

FindSequenceFunction[seq,n]//Factor

Table[n(n-1)(3n^2+13n-2)/12,{n,20}]

(seq=Table[HararyIndex[QueenGraph[n,n]],{n,20}])//Timing

FindLinearRecurrence[seq]

LinearRecurrence[{5,-10,10,-5,1},{0,6,32,98,230},40]

gf=x FindGeneratingFunction[seq,x]

CoefficientList[Series[((2 x(-3-x+(x^2)))/(((-1+x))^5)),{x,0,20}],x]

Rook n×n

A085740

seq=Table[GraphData[{"Rook",{n,n}},"HararyIndex"],{n,10}]

FindSequenceFunction[seq,n]//Factor

Table[((Binomial[n+1,2])^2)-(n^2),{n,10}]

Table[((PolygonalNumber[n])^2)-(n^2),{n,10}]

FullSimplify[((PolygonalNumber[n])^2)-(n^2)]

RookComplement n×n

A092364

seq=Table[GraphData[{"RookComplement",{n,n}},"HararyIndex"],{n,10}]

FindSequenceFunction[Drop[seq,2],n-2]//Factor

seq=Table[(n-1)(n^3)/2,{n,20}]

seq=Table[(n^2)Binomial[n,2],{n,20}]

FindLinearRecurrence[seq]

LinearRecurrence[{5,-10,10,-5,1},{0,4,27,96,250},20]

gf=x FindGeneratingFunction[seq,x]

CoefficientList[Series[-((x(4+7 x+(x^2)))/(((-1+x))^5)),{x,0,20}],x]

SierpinskiCarpet

seq=Table[GraphData[{"SierpinskiCarpet",n},"HararyIndex"],{n,4}]

(seq=Table[HararyIndex[SierpinskiCarpetGraph[n]],{n,3}])//Timing

SierpinskiSieve

seq=Table[GraphData[{"SierpinskiSieve",n},"HararyIndex"],{n,5}]

(seq=Table[HararyIndex[SierpinskiSieveGraph[n]],{n,8}])//Timing

(tallies=Table[Tally[Flatten[GraphDistanceMatrix[SierpinskiSieveGraph[n]]]],{n,5}])//Column

Not in OEIS:

tallies[[All,2;;,2]]/2//Column

FindSequenceFunction[seq,n]//Head

SierpinskiTetrahedron

seq=Table[GraphData[{"SierpinskiTetrahedron",n},"HararyIndex"],{n,6}]

(seq=Table[HararyIndex[SierpinskiTetrahedronGraph[n]],{n,6}])//Timing

(tallies=Table[Tally[Flatten[GraphDistanceMatrix[SierpinskiTetrahedronGraph[n]]]],{n,5}])//Column

Not in OEIS:

tallies[[All,2;;,2]]/2//Column

FindSequenceFunction[seq,n]//Head//Timing

Star

Entity["Graph",{"Star",n}]["HararyIndex"]

seq=Table[HararyIndex[StarGraph[n]],{n,20}]

FindSequenceFunction[seq,n]

Table[(1/4) (-1+n) (2+n),{n,20}]

Through[{Numerator,Denominator}[l]]

Sun

seq=Table[GraphData[{"Sun",n},"HararyIndex"],{n,3,20}]

FindSequenceFunction[seq,n-2]//Factor

Sunlet

seq=Table[GraphData[{"Sunlet",n},"HararyIndex"],{n,3,20}]

(seq=Table[HararyIndex[SunletGraph[n]],{n,3,40}])//Timing

FindSequenceFunction[seq,n-2]

FullSimplify[FindSequenceFunction[seq[[;;;;2]],(n-1)/2]]

Table[8-((5 n)/2)-(6/(1+n))-(6/(3+n))+4 n HarmonicNumber[(1/2) (-1+n)],{n,3,20,2}]

FullSimplify[FindSequenceFunction[seq[[2;;;;2]],n/2-1]]

Table[%,{n,4,20,2}]

({{\[Piecewise], ({{4 n (HarmonicNumber[(n/2)-1])-((5 n)/2)-(8/(n+2))-(4/(n+4))+12, (Mod[n, 2])==0}, {4 n (HarmonicNumber[((n-1)/2)])-((5 n)/2)-(6/(n+1))-(6/(n+3))+8, (Mod[n, 2])==1}})}})

Table[Piecewise[{
{12-((5 n)/2)-(8/(2+n))-(4/(4+n))+4 n HarmonicNumber[(n/2)-1],Mod[n,2]==0},
{8-((5 n)/2)-(6/(1+n))-(6/(3+n))+4 n HarmonicNumber[(1/2) (-1+n)],Mod[n,2]==1}
}],{n,3,40}]

Tetrahedral

seq=Table[GraphData[{"Tetrahedral",n},"HararyIndex"],{n,6,10}]

(seq=Table[HararyIndex[TetrahedralGraph[n]],{n,6,20}])//Timing

FindSequenceFunction[seq,n-5]//Factor

TorusGrid n×n

seq=Table[GraphData[{"TorusGrid",{n,n}},"HararyIndex"],{n,3,10}]

(seq=Table[HararyIndex[TorusGridGraph[n,n]],{n,3,35}])//Timing

(tallies=Table[Tally[Flatten[GraphDistanceMatrix[TorusGridGraph[n,n]]]],{n,15}])//Column

Not in OEIS

tallies[[All,2;;,2]]/2//Column

tallies[[All,All,2]]//Column

FindSequenceFunction[tallies[[All,1,2]],n]

tallies[[3;;,2,2]]

FindSequenceFunction[%,n-2]//Factor

tallies[[5;;,3,2]]

FindSequenceFunction[%,n-4]//Factor

tallies[[7;;,4,2]]

FindSequenceFunction[%,n-6]//Factor

last=tallies[[All,-1,2]]

FindSequenceFunction[last[[3;;;;2]],(n/2-1)/2]//Factor

FindSequenceFunction[last[[2;;;;2]],n/2]

Table[Piecewise[{{1,n==1},{(n^2),Mod[n,2]==0},{4(n^2),Mod[n,2]==1}}],{n,20}]

Table[Join[{n^2},Table[4k n^2,{k,n/2}],Table[4(Floor[n/2]-k+1)k n^2,{k,n/2-1}],{If[Mod[n,2]==0,1,4]n^2}],{n,7}]//Column

(tallies2=Table[Join[{n^2},Flatten@If[Mod[n,2]==0,
{s=Table[4k n^2,{k,n/2-1}],2n^2(n-1),Reverse[s],n^2},
{s=Table[4k n^2,{k,n/2}],Reverse[s]}]],{n,15}])//Column

tallies[[All,All,2]]===tallies2

Table[Table[4(n/2-k) n^2,{k,n/2-1}],{n,2,8,2}]

Table[Flatten[{Table[4k n^2,{k,n/2-1}],2(n^2)(n-1),Table[4(n/2-k) n^2,{k,n/2-1}],(n^2)}],{n,2,8,2}]//Column

(Sum[((4k n^2)/k),{k,n/2-1}]+((2(n^2)(n-1))/(n/2))+Sum[((4(n/2-k) n^2)/(n/2+k)),{k,n/2-1}]+((n^2)/n))/2//FullSimplify

Table[%,{n,2,12,2}]

FullSimplify[(1/2) n (-3+4 n+4 (n^2) (HarmonicNumber[n-1]-HarmonicNumber[(n/2)]))/.n->n+2]

Table[(1/2) (2+n) (-3+4 (2+n)+4 (((2+n))^2) (-HarmonicNumber[1+(n/2)]+HarmonicNumber[1+n])),{n,2,12,2}]//FullSimplify

Table[Flatten[{Table[4k n^2,{k,n/2}],Table[4((n+1)/2-k) n^2,{k,n/2}]}],{n,1,8,2}]//Column

(Sum[((4k n^2)/k),{k,(n-1)/2}]+Sum[((4((n+1)/2-k) n^2)/((n-1)/2+k)),{k,(n-1)/2}])/2//FullSimplify

FullSimplify[2 (n^3) (PolyGamma[0,n]-PolyGamma[0,((1+n)/2)])/.n->n+2]

Table[2 (((2+n))^3) (-HarmonicNumber[((1+n)/2)]+HarmonicNumber[1+n]),{n,1,10,2}]//FunctionExpand//FullSimplify

Table[Piecewise[{
{(1/2) (2+n) (-3+4 (2+n)+4 (((2+n))^2) (-HarmonicNumber[1+(n/2)]+HarmonicNumber[1+n])),Mod[n,2]==0},
{2 (((2+n))^3) (-HarmonicNumber[((1+n)/2)]+HarmonicNumber[1+n]),Mod[n,2]==1}}],{n,10}]

({{\[Piecewise], ({{(1/2) n (4 (n^2) ((HarmonicNumber[n-1])-(HarmonicNumber[(n/2)]))+4 n-3), (Mod[n, 2])==0}, {2 (n^3) ((HarmonicNumber[n-1])-(HarmonicNumber[((n-1)/2)])), (Mod[n, 2])==1}})}})

Table[Piecewise[{
{(1/2) n (4 (n^2) (HarmonicNumber[n-1]-HarmonicNumber[(n/2)])+4 n-3),Mod[n,2]==0},
{2 (n^3) (HarmonicNumber[n-1]-HarmonicNumber[((n-1)/2)]),Mod[n,2]==1}}],{n,3,10}]

FindSequenceFunction[seq,n-2]

FindSequenceFunction[seq[[;;;;2]],n]//Head//Timing

FindSequenceFunction[seq[[2;;;;2]],n]//Head//Timing

FindSequenceFunction[seq[[;;;;3]],n]//Head//Timing

FindSequenceFunction[seq[[;;;;4]],n]//Head//Timing

Transposition

A296194

Entity["Graph",{"Transposition",n}]["HararyIndex"]

seq=Table[GraphData[{"Transposition",n},"HararyIndex"],{n,6}]

(seq=Table[HararyIndex[TranspositionGraph[n]],{n,6}])//Timing

Do[Print[{{"Transposition",n},HararyIndex[TranspositionGraph[n]]//Timing}],{n,7}]

seq={0,1,12,162,3010,81000,3105396,162469104};

Head/@Table[FindSequenceFunction[Drop[seq,k],n-k],{k,0,3}]//Union//Timing

Head/@Table[FindLinearRecurrence[Drop[seq,k]],{k,0,3}]//Union//Timing

Head/@Table[FindGeneratingFunction[Drop[seq,k],x],{k,0,3}]//Union//Timing

(tallies=Table[Tally[Flatten[GraphDistanceMatrix[TranspositionGraph[n]]]],{n,7}])//Column

FindSequenceFunction[tallies[[2;;,2,-1]],n]

Table[n!Binomial[n,2],{n,6}]

FindSequenceFunction[tallies[[3;;,3,-1]],n]

{0,0,12,264,4200,61200,882000}/Range[7]!

Table[n!StirlingS1[n,n-2],{n,2,7}]

Table[n!(((-1))^3)StirlingS1[n,n-3],{n,3,8}]

Table[n!StirlingS1[n,n-4],{n,4,8}]

Table[Table[{k,(((-1))^k)n!StirlingS1[n,n-k]},{k,0,n-1}],{n,7}]//Column

Table[Sum[(((((-1))^k)n!StirlingS1[n,n-k])/k),{k,n-1}],{n,8}]/2

(1/2)Sum[(((((-1))^k)StirlingS1[n,n-k])/k),{k,n-1}]

seq=Table[n!Sum[(((((-1))^k)StirlingS1[n,n-k])/k),{k,n-1}]/2,{n,30}]

FindLinearRecurrence[Rest@seq]//Head

FindGeneratingFunction[seq,x]//Head//Timing

Triangular

seq=Table[GraphData[{"Triangular",n},"HararyIndex"],{n,2,20}]

FindSequenceFunction[seq,n-1]//Factor

TriangularGrid

A027480

seq=Table[GraphData[{"TriangularGrid",n},"HararyIndex"],{n,10}]

FindSequenceFunction[seq,n]//Factor

3Binomial[n+2,3]

Web

seq=Table[GraphData[{"Web",n},"HararyIndex"],{n,3,20}]

(seq=Table[HararyIndex[WebGraph[n]],{n,3,40}])//Timing

FindSequenceFunction[seq,n-2]

FullSimplify[FindSequenceFunction[seq[[;;;;2]],(n-1)/2]]

Table[%,{n,3,20,2}]

FullSimplify[FindSequenceFunction[seq[[2;;;;2]],n/2-1]]

Table[%,{n,4,20,2}]

({{\[Piecewise], ({{9 n (HarmonicNumber[(n/2)-1])-6 n-(20/(n+2))-(12/(n+4))+29, (Mod[n, 2])==0}, {9 n (HarmonicNumber[((n-1)/2)])-((2 n (3 (n^2)+2 n-15))/((n+1) (n+3))), (Mod[n, 2])==1}})}})

Table[Piecewise[{{29-6 n-(20/(2+n))-(12/(4+n))+9 n HarmonicNumber[(n/2)-1],Mod[n,2]==0},{-((2 n (-15+2 n+3 (n^2)))/((1+n) (3+n)))+9 n HarmonicNumber[(1/2) (-1+n)],Mod[n,2]==1}}],{n,3,40}]

Wheel

Entity["Graph",{"Wheel",n}]["HararyIndex"]

seq=Table[GraphData[{"Wheel",n},"HararyIndex"],{n,4,20}]

seq=Table[HararyIndex[WheelGraph[n]],{n,4,20}]

FindSequenceFunction[seq,n-3]//Factor

WhiteBishop n×n

A296200

seq=Table[GraphData[{"WhiteBishop",{n,n}},"HararyIndex"],{n,2,10}]

(seq=Table[HararyIndex[WhiteBishopGraph[n,n]],{n,2,20}])//Timing

coef=FindLinearRecurrence[seq]

Take[seq,Length@coef]

LinearRecurrence[{2,2,-6,0,6,-2,-2,1},{1,5,21,47,104,182,318,490},40]

FindSequenceFunction[seq,n-1]

gf=(x^2) FindGeneratingFunction[seq,x]

CoefficientList[Series[((-1-3 x-9 (x^2)-(x^3)+2 (x^4))/((((-1+x))^5) (((1+x))^3))),{x,0,20}],x]

FullSimplify[SeriesCoefficient[gf,{x,0,n}],n>0]

Factor[(-7+2 n (2+n))]

(1/96) (6 (n^4)+16 (n^3)-42 (n^2)+3 (((-1))^n) (2 (n^2)+4 n-7)-4 n+21)

Table[(21-4 n-42 (n^2)+16 (n^3)+6 (n^4)+3 (((-1))^n) (-7+4 n+2 (n^2)))/96,{n,10}]

Example

ShowLabeledGraph[g=AddEdges[AddVertices[Graph["C4"],{{-1,1},{1.2,1},{1.6,.7},{2,1}}],{{1,5},{4,6},{6,7},{7,8}}]]

seq={5,1,2,3,4,6,7,8};

ShowLabeledGraph[g2=Graph[List/@Edges[g]/.Thread[l->Range[8]],List/@Vertices[g][[l]]]]

p. 80

ReciprocalDistanceMatrix[g2]//TraditionalForm

Total[ReciprocalDistanceMatrix[g2],2]

Total[Flatten[ReciprocalDistanceMatrix[g2]]]

Checks/timing

DateString[]

$Version

Default

DeleteCases[Monitor[{g=#,GraphData[#,"HararyIndex"],HararyIndex[GraphData[#]]}&/@GraphData[;;100],g],{_,x_,x_}]//Timing

DeleteCases[Monitor[{g=#,GraphData[#,"HararyIndex"],HararyIndex[GraphData[#]]}&/@GraphData[;;1000],g],{_,x_,x_}]//Timing

DeleteCases[Monitor[{g=#,GraphData[#,"HararyIndex"],HararyIndex[GraphData[#]]}&/@GraphData[All],g],{_,x_,x_}]//Timing