The TransCompilator

Solved LeetCode program · 359 of 1,000

#0483 · Smallest Good Base

Hard Math chunk-08.md

Original English source

Keep a shared goal of 0. Keep a shared answer of 0. Set goal to 13.
To test with base (a whole number). The total is 1. The term is 1.
Repeat while term is less than goal.
Set term to term times base. If total plus term is at most goal, add term to total. If term is at least goal and total is goal and answer is 0, set answer to base.

For every base from 2 to goal minus 1.
Test with base.

The result is format whole number answer as text. Show result.

Open in Playground Browse all 1,000 problems

Expected stdout

3