sub S {
    my ($A, $B) = @_;
    my @th1 = (1,0,0,0);
    for (my $i = 0; $i < $B; $i++) {
        $th1[3] = 0;
        while ($th1[3] < $A) {
            $th1[1] = $th1[2];
            $th1[2] = $th1[2] + $th1[0];
            $th1[3] = $th1[2] * $th1[2];
        }
        $th1[2] = $th1[1];
        $th1[0] = $th1[0] * 0.1;
    }
    return $th1[2];
}
print S(2,10);

Embed on website

To embed this project on your website, copy the following code and paste it into your website's HTML: