Russian Peasant Spreadsheet

If you consider spreadsheet formulas a programming language, and I do, then you could solve the Russian Peasant Multiplication challenge with a spreadsheet.

D3: =SUM(D4:D35)
A4: =B1
C4: =B2
D4: =IF(ISODD(A4),C4,””)
A5: =IF(OR(ISTEXT(A4),A4=1),””,INT(A4/2))
B5: =IF(OR(ISTEXT(A4),A4=1),””,”x”)
C5: =IF(OR(ISTEXT(A4),A4=1),””,C4*2)
D5: =IF(OR(ISTEXT(A4),A4=1),””,IF(ISODD(A5),C5,””))

Then filled down.

Posted in Uncategorized

2 thoughts on “Russian Peasant Spreadsheet

  1. Just a different way

    B3: =SUMPRODUCT(–(MOD(A4:A100,2)=1),C4:C100)
    A4: =B1
    B4: x
    C4: =B2
    A5: =FLOOR(A4/2,1)
    B5: =IF(A5,”x”,””)
    C5: =IF(A5,2*C4,0)

    Fill down A5:C5.
    Format A5:C100 #,##0;;
    CF A4:C100 Formula is: “=MOD($A4,2)=0? Format: Font/Strikethrough

    Note: I use MOD(x,2) rather than ISODD() or ISEVEN() to avoid the ATPA.

Leave a Reply

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