Block 1 - Set number of discs
- Type / Role
- n8n-nodes-base.set - set
- Config choices
- Version 3.4
This workflow is provided as-is. Please review and test before using in production.
How it works This is an example of using sub workflow nodes and a proof of concept showing that it’s possible to solve and explain recursive problems with n8n . Towers of Hanoi Task Move a stack of...
n8n-nodes-base.set, n8n-nodes-base.if, n8n-nodes-base.executeworkflow, n8n-nodes-base.executeworkflowtrigger, n8n-nodes-base.code, n8n-nodes-base.stickynote, n8n-nodes-base.manualtrigger
This workflow is cataloged by N8N Workflows and links back to its original n8n.io source page by Adrian.
Original n8n.io sourceThis is an example of using sub-workflow nodes and a proof of concept showing that it’s possible to solve and explain recursive problems with n8n.
Move a stack of n disks from rod A to rod C, using rod B as auxiliary. Only one disk can be moved at a time, and no disk may be placed on a smaller disk.
n=4
| | |
= | |
=== | |
===== | |
======= | |
--------- --------- ---------
A B C
procedure Hanoi(n, X, Y, Z):
if n == 1:
move disk from X to Z
else:
Hanoi(n-1, X, Z, Y)
move disk from X to Z
Hanoi(n-1, Y, X, Z)
This catalog entry is organized from the workflow JSON. The node-level section below shows the executable blocks available for review before importing the template.
| Workflow | Implement recursive algorithms with sub-workflows: Towers of Hanoi demo |
|---|---|
| Complexity | advanced |
| Nodes | 21 |
| Categories | Engineering, Multimodal AI |
| Author | Adrian |
| Published | 16 Sept 2025 |
Use the JSON export at /data/workflows/8656/8656.json as the source template for this automation.
Open n8n, import the downloaded JSON, and review each node before activating the workflow.
Replace placeholder credentials, API keys, webhook URLs, account IDs, and environment-specific values with your own settings.
Run the workflow manually or in a staging workspace, inspect node output, and confirm downstream systems receive the expected data.
Enable the workflow only after testing, then monitor executions, errors, and rate limits during the first production runs.
Review imported nodes carefully before activation. This catalog entry is intended to help you inspect the workflow structure, understand required services, and find related templates faster.
Node names, credentials, schedules, webhook paths, and external service limits may need adjustment for your workspace.
How it works This is an example of using sub workflow nodes and a proof of concept showing that it’s possible to solve and explain recursive problems with n8n . Towers of Hanoi Task Move a stack of...
Review the workflow JSON, configure any required credentials in n8n, and test the automation in a safe workspace before using it in production.
Yes. Use the block-by-block analysis and the downloadable JSON to inspect each node, then adjust credentials, prompts, schedules, filters, or destinations for your Engineering, Multimodal AI use case.