Clio Corvid

Writer – Teacher

Menu
  • Welcome
  • Writing
    • Poetry
    • Fragments
    • AI-generated
  • Mathematics
    • Algebra
    • Calculus
    • General
    • Geometry
    • Notation
    • Pedagogy
    • Puzzles and Memes
  • Reflections
    • Diary
    • Reflections
    • Bein’ Enby (Medium)
    • Inside My Mind
    • Other essays
  • Closed Blogs
    • Cerebri Laevi
    • Father’s Opinion
    • Good Men Project
    • Into the Labyrinth
    • Sisyphus Winced
    • Prawn Salad, Ltd.
Menu

Pseudocode for the Russian peasant method of binary

Posted on February 10, 2014June 19, 2023 by Clio

Just for fun… Here’s the pseudocode for the method of building a binary number from a decimal number, based on the Russian peasant method of multiplication:

function mybin(mydec) {

mybin = "";

do while mydec > 0 {
if mydec is odd: {
mydec = mydec - 1;
mybin = "1" + mybin; }
else: mybin = "0" + mybin;
mydec = mydec / 2; }
return mybin; }

Share this:

  • Email a link to a friend (Opens in new window) Email
  • Print (Opens in new window) Print
  • Share on Facebook (Opens in new window) Facebook
  • Share on LinkedIn (Opens in new window) LinkedIn
  • Share on Mastodon (Opens in new window) Mastodon
  • Share on X (Opens in new window) X
  • Share on WhatsApp (Opens in new window) WhatsApp

Leave a Reply Cancel reply

Your email address will not be published. Required fields are marked *

Recent Posts

  • Checking In
  • Fractious Fractions
  • Into the Cornfield
  • How Soon Is Now?
  • Roman Re-enacting: Malden 2025

Archives

Log in
©2026 Clio Corvid