I've been into fitness for quite some time. Personally, for logging my workouts I love to use Fitocracy. As for finding my rep max and getting back into a workout routine... I took a geekier approach.

Why and what it taught me

This script was my way to learn how to do some math in PowerShell. From percentages to basic rounding, and then some. I wanted to do the rounding so the "plate" math made more sense.

Here are some ways to run the script:

.\531.ps1 -Max 145 -Reps 10

Running it like this will give you an output in the console of what your 5/3/1 routine at this max and rep range would be.

Another way to run it would be:

.\531.ps1 -Max 145 -Reps 10 -sendEmail email@address.com -workoutName Squats

The above would send the routine to that email address with the workout name in the subject line.

What you'll need to setup

If you want to use the email portion of this script you'll want to change the variables $emailUser, $emailFrom, $emlSignature, and if you're not using Gmail $SMTPServer.

You can use the line that's commented out to store your password locally, machine key encrypted.

#"password" | ConvertTo-SecureString -AsPlainText -Force | ConvertFrom-SecureString | Out-File .\emlpassword.txt

The Code

# Let's get our variables set
[cmdletbinding()]
param (
    [int]
    $Max,
    [int]
    $Reps,
    [double]
    $TMp,
    [string]
    $sendEmail,
    [string]
    $workoutName
)

if (!$Max)     {[int]$Max      = read-host "Weight?"}
if (!$Reps)    {[int]$Reps     = read-host "for how many reps?"}
if (!$TMp)     {[double]$TMp = .85}


#"password" | ConvertTo-SecureString -AsPlainText -Force | ConvertFrom-SecureString | Out-File .\emlpassword.txt

$emailPass    = Get-Content .\emlpassword.txt | ConvertTo-SecureString  

#Setup the email username and from address.
$emailUser    = 'emailuser'
$emailFrom    = 'youremail@gmail.com'
$emlSignature = '-Your Name'
$SMTPServer   = 'smtp.gmail.com'
$tmPretty     = $TMp * 100
$tmPretty     = $tmpretty.ToString() + "%"
[int]$roundBy = 10 


#Numbers boys! (and girls too...)
[int]$weight   = ([system.math]::round(($max * $reps * 0.0333 + $max)/$roundBy))*$roundBy 
[int]$tm       = ([system.math]::round(($tmp * $weight)/$roundBy))*$roundBy
[int]$warm     = ([system.math]::round((.10 * $tm)/$roundBy))*$roundBy

#Work sets
[int]$work1    = ([system.math]::round((.65 * $tm)/$roundBy))*$roundBy
[int]$work2    = ([system.math]::round((.75 * $tm)/$roundBy))*$roundBy
[int]$work3    = ([system.math]::round((.85 * $tm)/$roundBy))*$roundBy
[int]$work12   = ([system.math]::round((.70 * $tm)/$roundBy))*$roundBy
[int]$work22   = ([system.math]::round((.80 * $tm)/$roundBy))*$roundBy
[int]$work32   = ([system.math]::round((.90 * $tm)/$roundBy))*$roundBy
[int]$work13   = ([system.math]::round((.75 * $tm)/$roundBy))*$roundBy
[int]$work23   = ([system.math]::round((.85 * $tm)/$roundBy))*$roundBy
[int]$work33   = ([system.math]::round((.95 * $tm)/$roundBy))*$roundBy
[int]$bbbfwks  = ([system.math]::round((.40 * $tm)/$roundBy))*$roundBy
[int]$bbbfwks2 = ([system.math]::round((.50 * $tm)/$roundBy))*$roundBy

#Warm up sets
[int]$wset1    = $work1 - $warm
[int]$wset2    = $wset1 - $warm
[int]$wset3    = $wset2 - $warm
[int]$wset12   = $work12 - $warm
[int]$wset22   = $wset12 - $warm
[int]$wset32   = $wset22 - $warm
[int]$wset13   = $work13 - $warm
[int]$wset23   = $wset13 - $warm
[int]$wset33   = $wset23 - $warm

#Let's build the body
$body =  Write-Output `n "531 Workout!" `n
$body += Write-Output "Your estimated 1RM is: $weight" 
$body += Write-Output "Your $tmPretty training max is: $tm" 
$body += Write-Output "Warm up lbs: $warm" `n

$body += Write-Output "Week 1" `n

$body += Write-Output "Warm up sets:" `n

$body += Write-Output "$wset3 x 5"
$body += Write-Output "$wset2 x 5"
$body += Write-Output "$wset1 x 3" `n

$body += Write-Output "Work sets:" `n
$body += Write-Output "$work1 x 5"
$body += Write-Output "$work2 x 5"
$body += Write-Output "$work3 x 5+" `n
$body += Write-Output "BBB" 
$body += Write-Output "5x10 @ $bbbfwks" `n

$body += Write-Output "Week 2" `n

$body += Write-Output "Warm up sets:" `n
$body += Write-Output "$wset32 x 5"
$body += Write-Output "$wset22 x 5"
$body += Write-Output "$wset12 x 3" `n

$body += Write-Output "Work sets:" `n
$body += Write-Output "$work12 x 5"
$body += Write-Output "$work22 x 5"
$body += Write-Output "$work32 x 3+" `n
$body += Write-Output "BBB" 
$body += Write-Output "5x10 @ $bbbfwks" `n

$body += Write-Output "Week 3" `n

$body += Write-Output "Warm up sets:" `n
$body += Write-Output "$wset33 x 5"
$body += Write-Output "$wset23 x 5"
$body += Write-Output "$wset13 x 3" `n

$body += Write-Output "Work sets:" `n
$body += Write-Output "$work13 x 5"
$body += Write-Output "$work23 x 5"
$body += Write-Output "$work33 x 1+" `n
$body += Write-Output "BBB" 
$body += Write-Output "5x10 @ $bbbfwks2" `n `n
$body += Write-Output $emlSignature
$body = $body | Out-String

function Send-531Email {

    [cmdletbinding()]
    param(
    [Parameter(Mandatory=$true,ValueFromPipeline=$true)]
    [string]
    $To,
    
    [string]
    [Parameter(Mandatory=$true,ValueFromPipeline=$true)]
    $Subject,
    
    [Parameter(Mandatory=$true,ValueFromPipeline=$true)]
    $Body)

    if (!$to)      {Write-Error "No recipient specified";break}
    if (!$subject) {Write-Error "No subject specified";break}
    if (!$body)    {Write-Error "No body specified";break}
   
       
    $SMTPClient  = New-Object Net.Mail.SmtpClient($SmtpServer, 587) 
    $SMTPMessage = New-Object System.Net.Mail.MailMessage($EmailFrom,$To,$Subject,$Body)

    $SMTPClient.EnableSsl = $true 
    $SMTPClient.Credentials = New-Object System.Net.NetworkCredential($emailUser,$emailPass); 
    
    $SMTPClient.Send($SMTPMessage)

}

if ($sendEmail) {Send-531Email -to $sendEmail -Subject "531 workout schedule for: $workoutName" -Body $body} else { $body }