# Hailstone Sequence

> Compute the complete Hailstone sequence for a given starting number by repeatedly calling the next_number tool until the value 1 is reached. Use when this capability is needed.

- Skill: `tomevault-io/hailstone-sequence` (Agent Skill, multi-file: 2 files)
- Install (CLI): `npx skillmds@latest add tomevault-io/hailstone-sequence`
- Raw SKILL.md: https://api.skillmd.com/api/skills/tomevault-io/hailstone-sequence/raw
- Safety review: pending (external: skill-scanner PASS, skillspector PASS)
- Works with: Claude Code, Claude.ai, OpenAI Codex
- Category: AI & ML
- Author: tomevault-io (https://skillmd.com/u/tomevault-io)
- Updated: 2026-09-17
- Page: https://skillmd.com/skills/tomevault-io/hailstone-sequence

---


# Hailstone Sequence

Compute the full Hailstone (Collatz) sequence from a starting number down to 1
using the `next_number` tool.

## Arguments

The user must provide a **starting number** (a positive integer greater than 1).

If no starting number is given, ask the user before proceeding.

## Steps

### 1. Initialize

Set the current number `x` to the starting number provided by the user.

Begin tracking the sequence as a list: `[x]`.

### 2. Call the tool

Call `next_number` with the current value of `x`.

```
next_number(x=<current_number>)
```

**STOP and WAIT** for the tool result before continuing.

### 3. Record the result

Append the returned value to the sequence list.

Set `x` to the returned value.

### 4. Check termination

- If `x == 1`, proceed to Step 5.
- Otherwise, go back to Step 2.

**Important rules:**
- NEVER fabricate or simulate tool call results.
- NEVER make multiple tool calls in a single response.
- ALWAYS wait for the actual tool response before deciding next steps.

### 5. Report the result

Print the complete sequence from start to finish, for example:

```
6 → 3 → 10 → 5 → 16 → 8 → 4 → 2 → 1
```

Also report:
- **Starting number**
- **Total steps taken** (number of tool calls made)
- **Maximum value reached** in the sequence

---
> Source: [nerdai/llm-agents-from-scratch](https://github.com/nerdai/llm-agents-from-scratch) — distributed by [TomeVault](https://tomevault.io).
<!-- tomevault:4.0:skill_md:2026-07-07 -->

