COMay 4, 2025
The Towers of Fibonacci, Lucas, Pell, and JacobsthalEl-Mehdi Mehiri, Saad Mneimneh, Hacène Belbachir
We present in this paper four new variants of the Tower of Hanoi problem, the optimal solution of each of these variants is related to one of the four known numbers Fibonacci, Lucas, Pell, and Jacobsthal. We give an optimal solution to each of these variants, and we present their associated graphs.
CODec 31, 2022
Enumerating moves in the optimal solution of the Tower of HanoiHacène Belbachir, El-Mehdi Mehiri
In the Tower of Hanoi problem, there is six types of moves between the three pegs. The main purpose of the present paper is to find out the number of each of these six elementary moves in the optimal sequence of moves. We present a recursive function based on indicator functions, which counts the number of each elementary move, we investigate some of its properties including combinatorial identities, recursive formulas and generating functions. Also we found and interesting sequence that is strongly related to counting each type of these elementary moves that we'll establish some if its properties as well.
DMAug 13, 2022
The weighted Tower of HanoiEl-Mehdi Mehiri, Hacène Belbachir
The weighted Tower of Hanoi is a new generalization of the classical Tower of Hanoi problem, where a move of a disc between two pegs $i$ and $j$ is weighted by a positive real $w_{ij}\geq 0$. This new problem generalizes the concept of finding the minimum number of moves to solve the Tower of Hanoi, to find a sequence of moves with the minimum total cost. We present an optimal dynamic algorithm to solve the weighted Tower of Hanoi problem, we also establish some properties of this problem, as well as its relation with the Tower of Hanoi variants that are based on move restriction.
1.5COMay 16
The Weighted Tower of Hanoi: Algebraic Structure, Phase Transitions, and Integer SequencesAndreas M. Hinza, El-Mehdi Mehiri
We develop a unified algebraic theory of the weighted Tower of Hanoi with arbitrary nonnegative symmetric move costs depending on both disc index and pegs. Starting from a general optimality recurrence with two competing strategies -- one largest-disc move (one-LDM) and two largest-disc moves (two-LDM) -- we derive complete matrix formulations for both regimes and obtain explicit closed forms for the minimal transfer cost. The one-LDM dynamics is governed by a nontrivial linear operator whose spectral decomposition reveals a fundamental connection with the Jacobsthal and Lichtenberg sequences, while the two-LDM dynamics exhibits pure exponential growth. This framework yields exact solutions for broad classes of weight models, including peg-symmetric, disc-symmetric, polynomial, geometric, arithmetic, and sequence-induced costs. In particular, choosing classical integer sequences (Fibonacci, Lucas, Jacobsthal, Pell, Euler, etc.) as disc weights produces new derived sequences with explicit formulas and recurrences, establishing the Tower of Hanoi as a sequence-generating transform. We further introduce and analyze models with forbidden moves and move-type-dependent weights, uncovering a phase transition phenomenon in which the optimal strategy switches from two-LDM behavior for small discs to one-LDM behavior beyond a finite threshold. Our results provide a comprehensive algebraic and combinatorial understanding of weighted Hanoi dynamics and expose deep connections between optimal solutions and classical integer sequences.
31.7COMar 11
M-Polynomial of Product GraphsEl-Mehdi Mehiri, Sandi Klavžar
The M-polynomial provides a unifying framework for a wide class of degree-based topological indices. Despite its structural importance, general methods for computing the M-polynomial under graph constructions remain limited. In this paper, explicit formulas, and compact ones whenever possible, for the M-polynomial under different graph products whose vertex sets are the Cartesian product of the factors are developed. The products studied are the direct, the Cartesian, the strong, the lexicographic, the symmetric-difference, the disjunction, and the Sierpiński product. The obtained formulas yield a unified structural description of how vertex-degree interactions propagate under graph constructions and extend existing results for degree-based indices at the polynomial level.
9.4COApr 9
The Power Contamination Problem on Grids Revisited: Optimality, Combinatorics, and Links to Integer SequencesEl-Mehdi Mehiri, Mohammed L. Nadji
This paper presents a combinatorial study of the power contamination problem, a dynamic variant of power domination modeled on grid graphs. We resolve a conjecture posed by Ainouche and Bouroubi (2021) by proving it is false and instead establish the exact value of the power contamination number on grid graphs. Furthermore, we derive recurrence relations for this number and initiate the enumeration of optimal contamination sets. We prove that the number of optimal solutions for specific grid families corresponds to well-known integer sequences, including those counting ternary words with forbidden subwords and the large Schröder numbers. This work settles the fundamental combinatorial questions of the power contamination problem on grids and reveals its rich connections to classical combinatorics.
CONov 16, 2025
Explicit M-Polynomial and Degree-Based Topological Indices of Generalized Hanoi GraphsEl-Mehdi Mehiri
The M-polynomial, introduced by Deutsch and Klavžar in 2015, provides a unifying algebraic framework for the computation of numerous degree-based topological indices such as the Zagreb, Randic, harmonic, and forgotten indices. Despite its broad applications in chemical graph theory and network analysis, closed expressions of the M-polynomial remain unknown for many important graph families. In this work we derive, for the first time, a complete explicit expression of the M-polynomial of the generalized Hanoi graphs $H_p^n$ for arbitrary positive $p$ and $n$. Our derivation relies on a detailed combinatorial analysis of the occupancy-based structure of $H_p^n$, refined using Stirling and $2$-associated Stirling numbers to enumerate all configurations with prescribed singleton and multiton counts. We obtain closed formulas for all diagonal and off-diagonal coefficients of the M-polynomial and show how these expressions yield exact values of the main degree-based topological indices. The correctness of the formulas is supported through numerical computation in small instances. These results provide a complete degree-based description of $H_p^n$ and make their structural complexity fully accessible through the M-polynomial framework.