Skip to content

Instantly share code, notes, and snippets.

@hellvesper
Created August 15, 2017 12:16
Show Gist options
  • Save hellvesper/4ce435b11d1356b70e43c1e66e18d17b to your computer and use it in GitHub Desktop.
Save hellvesper/4ce435b11d1356b70e43c1e66e18d17b to your computer and use it in GitHub Desktop.
<?php
/**
* Created by PhpStorm.
* User: vesper
* Date: 15/08/2017
* Time: 14:21
*/
function progression($x = 4, $n = 0, $count = 3) {
$x = $x + (2 * (3 ** $n));
echo "x = ".$x.PHP_EOL;
echo "n = ".$n.PHP_EOL;
$n++;
if (! ($count < 0)) {
echo "count: ".$count.PHP_EOL;
$count--;
return progression($x, $n, $count);
} else return 1;
}
progression();
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment