Rosetta Code

Kaprekar routine

Apply the Kaprekar routine to a 4-digit number and watch it converge to 6174.

Edit the source, then Run. Checks start after your first Run. Ctrl/⌘ + Enter runs; Tab indents. Preview services use sample data and never contact a real service.

rosettacode/popular/kaprekar_routine.vibe
Output
Click Run example to see the result.

Code checks

Run once to load the checker. Your code stays in this browser.