Sierpinski Triangle and Pascal Triangle
What is it?
Sierpinski Triangle
Sierpinski’s triangle is one of the most famous fractals, its construction is one of the first laboratory work on recursion in the relevant disciplines in many universities. The fractal looks like this:

Pascal's Triangle
Pascal's triangle is an infinite table of binomial coefficients, having a triangular shape. In this triangle, there are units at the top and sides. Each number is equal to the sum of two numbers located above it. The lines of the triangle are symmetrical about the vertical axis.

So what?
There is an interesting feature in the Pascal triangle. It displays the above fractal with its numbers. If you peer into the
Well, less words, more work. We conclude a little more clearly. For people who are not interested in software implementation, the following paragraph will be uninteresting.
I took the old Pascal triangle calculation-output algorithm and converted it in such a way that instead of the value of the numbers, the remainder of its division by 2 is displayed. Therefore, even now become zeros, odd ones become ones. I attach the code below
#include
using namespace std;
double Cnk(int N,int K)
{
return ((N(Cnk(j,i)))%2<<" ";
cout<<"\n";
}
return 0;
}
For the sake of clarity, I decorated the output in the following way: the output of the program is redirected to a file, from where, upon completion of the first, the pearl replaces units with red letters O, zeros with blue letters. The script code is below:
#! perl -w
open (STREAM_IN, '1.txt');# || die "Can't open STREAM_IN\n";
open (STREAM_OUT, '>> 1.html');# || die "Can't open STREAM_OUT\n";
$ss='
';
while ($curr = )
{
chomp($curr);
$curr=~s/1/O<\/font>/g;
$curr=~s/0/O<\/font>/g;
$curr=~s/-//g;
$out = $curr.$ss;
print (STREAM_OUT $out);
};
close STREAM_IN;
close STREAM_OUT;
From the source it is clear that we will watch html. Why? For reasons of simplicity. Only the DOM tree is incorrect. We fix this with a BASH script and automate all of the above:
#!/bin/bash
g++ ~/serp.cpp;
~/a.out > ~/1.txt;
echo '
TRIANGLE ' > ~/1.html;
perl ~/s.pl;
echo '
' >> ~/1.html
So, we compile the source on the pros, its output goes to the text box, the bash “echoes” in html to be rewritten by the beginning of the DOM tree, after which the text box takes the pearl script, transforms it into a multi-colored html version, supplements the html box, after which the kind BAS again completes the formation of the tree. We start, look:

We emphasize and compare with the original

PROFIT