²-
²+
easily factored
found other factors
Press C to refresh
Change Row Limit
¦
+
-
Refactor

# Introduction

Welcome to jotaki.github.io. Formally spiryx.net. The purpose of this website is to create a place where I can place various bits of information. It also serves as a place for me to dabble and tinker with CSS, JavaScript, and HTML.

## Compliance

This page requires a modern Web Browser with JavaScript enabled in order to function and look proper. If you are having issues with this webpage please consider updating your browser to a later version. This webpage is also not considered to be mobile friendly. How it looks, and functions on a mobile device is unknown, and is not expected to be supported any time in the near future. Users with accessibility issues, and of Internet Explorer may also find it difficult to navigate this page.

# What you will find?

The intended content of this page is mostly documentation related. With the occassional javascript rich application.

# A note on progress

This site is in a state of construction. Sections may be incomplete, and/or broken. Sections may also change, move, or be removed entirely all together.

# Why?

For the same reason anything happens.

# Chat

Find me on IRC. (ircs://irc.freenode.net/peltkore) webchat.freenode.net

# Multiplication Triangle

The multiplication triangle is just the multiplication table read diagonally. For example, if we look at this simple 5x5 multiplication table and transpose it, you will quickly see what I mean.

```         ↙  ↙  ↙  ↙  ↙
1  2  3  4  5           1                              1
↗  2  4  6  8  10          2  2                         2   2
↗  3  6  9  12 15   ->     3  4  3         ->         3   4   3
↗  4  8  12 16 20          4  6  6  4               4   6   6   4
↗  5 10  15 20 25          5  8  9  8  5          5   8   9   8   5
↗```

What's fascinating about reading the multiplication table like this, is it reveals some very interesting patterns. Before we get into that though, it would be helpful if we could generate the triangle table. For that, we will use the following function. Where r is the row, and c is the column.

`        g(r, c) -> c * (r - (c - 1))`

Not only can we use row and column values to retrieve a value, but we can also use a simple N-lookup. What I mean is, to find say the 30'th table entry, we need only the following formula:

```        f(n) ->
r = sqrt(2*n)
r += ((r*(r+1))/2+1 <= n)
c = n - (r*(r-1))/2
c * (r - (c - 1))   `/* should look familiar */````

N in this case is an index retrieved by the following function:

`        f(r, c) -> r*(r-1)/2 + c`

If you are not familiar, you should know that the sum of N odds is the value of N², and that the sum of N evens is the value of N*(N+1). This gives us the resulting formula that the sum of consecutive numbers is: (N*(N+1))/2.

As we read the multiplication table as a triangle we come to see that each row is merely the sum of it's terms less one. For example, we know that 2*5 = 10. This means that we should find 10 on row 6 (2+5-1), and columns 2, and 5. In this way, we could come to see that this table is really a representation of the following sequence:

```        1.) 1 * 1
2.) 2 * 1, 1 * 2
3.) 3 * 1, 2 * 2, 1 * 3
4.) 4 * 1, 3 * 2, 2 * 3, 1 * 4
5.) 5 * 1, 4 * 2, 3 * 3, 2 * 4, 1 * 5
6.) 6 * 1, 5 * 2, 4 * 3, 3 * 4, 2 * 5, 1 * 6
…```

This means that the center value for a given row can be calculated quite easily, since it will always be N² or N(N+1) depending on whether or not the given N is even or odd. The formula for this can be found below.

```        `;; n is row`
f(2n) = (n/2)(n/2+1)
f(2n+1) = ((n+1)/2)^2
f(n) ->
r = (n + (n % 2)) / 2   `;; r = (n+1)/2 if odd, n/2 if even`
r * (r + (1 - (n % 2))) `;; r^2 if odd, r*(r+1) if even````
Knowing the sum of all values, whose factors add up to some N could be useful. Somewhere, maybe. probably not.
```        f(2n+1) ->
m = (n+1)/2
2 * (m^3 - (m*(m-1)*(2*(m-1)+1)/6)) - m^2
f(2n) ->
`; eh? haven't bothered to deduce this yet````
When we consider A*B, what can we really know?
```        a*b = c (2n+1)

Q = (a+b)/2
W = (a-b)/2
R = 2*Q-1
C = Q - W
I = R*(R-1)/2 + C
N = C * (R - (C - 1))
B = C `;; (Q - W) -> ((a+b)/2) - ((a-b)/2) -> 2*b/2 -> b`
A = (R - (C - 1))

N == A * B == Q² - W² == c```

This is an unfinished application. The pool table is NOT mine. I wish I could remember where I got it from.

# Linux Related

• Certificates A quick overview and command reference for dealing with various certificate types.
• OpenSSH: Generate an ssh key Quick command reference for generating an ssh certificate.
``` # check ``man 1 ssh-keygen'' for details. ssh-keygen -f ~/.ssh/mykey -t rsa -b 2048 -C "key for myhost" ```
• OpenSSH: Generating an SSH CA Key Same as generating an ssh client key.
``` # check ``man 1 ssh-keygen'' for details. ssh-keygen -f myhostca.ca -t rsa -b 4096 -C "CA For my host" ```
• OpenSSH: Generate a user certificate using their (public) key. Sign your user's public key with one of your host's CA's.
``` # check ``man 1 ssh-keygen'' for details ssh-keygen -s myhostca.ca \ \ -I identifier \ \ [-n principles] \ \ [-V validity_interval ] \ \ myusersey.pub ```
• OpenSSH: List details about a users certificate Show details about a users certificate.
``` # check ``man 1 ssh-keygen'' for details. ssh-keygen -Lf myuserkey-cert.pub \myuserkey-cert.pub: \ Type: ssh-rsa-cert-v01@openssh.com user certificate \ Public key: RSA-CERT SHA256:ABCDEFGHIJKLMNOPQRSTUVWXYZabcdef... \ Signing CA: RSA SHA256:rstuvwxyz0123456789abcdefghijklmnopqr... \ Key ID: "myuserkey" \ Serial: 0 \ Valid: forever \ Principals: (none) \ Critical Options: (none) \ Extensions: \ permit-X11-forwarding \ permit-agent-forwarding \ permit-port-forwarding \ permit-pty \ permit-user-rc ```
• OpenSSL: Connect to a host using SSL/TLS Use openssl to connect to a host via SSL/TLS
``` # check ``man 1 s_client'' for details openssl s_client -connect www.google.com:443 ```
• OpenSSL: Generate a Server certificate (self signed) The command to generate a self signed certificate, using openssl's req command.
``` # see ``man 1 req'' for more details. openssl req -x509 \ \ -newkey rsa:2048 \ \ -keyout server.pem \ \ -out server.pem \ \ -days 30 \ \ -subj '/C=.../ST=.../L=.../O=.../OU=.../CN=.../emailAddress=.../' \ \ [ -nodes ] # no password. ```
• OpenSSL: Bind to a port using openssl's s_server command Using openssl s_server, we can bind to a port to create a secure listening connection
``` # see ``man 1 s_server'' for more details. openssl s_server -accept 4443 \ \ -cert server.pem \ \ -key server.pem ```

# Maths Related

• Multiplication Triangle A silly thing, but interesting to glance over maybe.
• Greatest Common Divisor Find the greatest common divisor for the given values.
``` gcd(a,0) = a gcd(a,b) = gcd(b,a%b) ```
• Modular Inverse Find x ≡ a⁻¹ (mod m).
The Extended Euclidean Algorithm without computing the Bézout coefficient of n.
``` inverse(a, b) -> t = 0, tk = 1; r = b, rk = a; while rk ≠ 0 -> q = r/rk; m = t-q*tk; t = tk, tk = m; m = r-q*rk; r = rk, rk = m; ;; (r > 1? 0: t + (t < 0? b: 0)) ;; ```
• Least Common Multiple Find the smallest integer that divides both a and b.
``` lcm(a,b) = b * (a/gcd(a,b)); ```
• Reverse a number Reverse a number in a given a base.
``` reverse(0, o, b) = o reverse(i, o, b) -> reverse(floor(i/b), o*b+(i%b), b); ;; Example:   reverse(351, 0, 10) ->   reverse(35, 1, 10) ->   reverse(3, 15, 10) ->   reverse(0, 153, 10) = 153 ```
• Pythagorean theorem a² + b² = c²
• Digital Root Find the digial root for a given number n for some given base b.
``` d(n,b) -> ((n-1) % (b-1)) + 1 ;; ```

# Miscellaneous

• My Github repository Shameful self promotion- There's really nothing of interest there.

# Books and PDFs

• The Portable Jung, edited by Joseph Campbell
• Basic Physics, A Self-Teaching Guide, by Karl F. Kuhn
• Collins dictionary of Mathematics, Collins
• String Theory, Volume I, An Introduction To The Bosonic String, by Joseph Polchinski
• String Theory, Volume II, Superstring Theory and Beyond, by Joseph Polchinski
• The C Programming Language, Second Edition, by Brian W. Kernighan and Dennis M. Ritchie
• Music by the Numbers, From Pythagoras to Schoenberg, by Eli Maor
• Musimathics, Volume I and volume II, by Gareth Loy
• Mudras of India, by Cain Carroll and Revital Carroll

This is where I'd place an about me page, if I cared about that sort of thing.

# OpenSSH

## What is OpenSSH?

According to their website

OpenSSH is the premier connectivity tool for remote login with the SSH protocol. It encrypts all traffic to eliminate eavesdropping, connection hijacking, and other attacks. In addition, OpenSSH provides a large suite of secure tunneling capabilities, several authentication methods, and sophisticated configuration options.

OpenSSH consists of several different applications, used for a variety of different purposes. But all, utimately aiming to give you secure remote access to a machine that is listening on a port capable of speaking the SSH Protocol. Here is a quick list of applications you can expect to find when you install OpenSSH.

Application
Description
sshd
Binds to a port, providing SSH protocol support.
ssh
Remotely connects to a running SSH server.
scp
Copy files to and/or from a remote server over SSH.
sftp-server
An SSH Subsystem that provides FTP-Like support.
sftp
Copy files to and/or from a remote server using the sftp Subsystem.
ssh-agent
A client daemon that manages ssh keys.
Manage keys within a currently running ssh-agent daemon.
ssh-keygen
A tool used to generate key pairs.

## What is SSH?

SSH stands for Secure Shell, and consists of several layers documented over several RFC's. To speak extensively about these would be out of scope for this document. However, for completeness sake they should be mentioned. In short, we will say that the SSH protocol enables a secure transport over an insecure network.

RFC
Description
The architecture of the SSH Protocol
The authentication protocol
The transport layer
The connection protocol

## Obtaining OpenSSH

### Debian

``` sudo apt-get install openssh-server ```

### RHEL / CentOS

``` sudo yum install openssh-server ```

### Gentoo

``` sudo emerge net-misc/openssh ```

### Other

If you are running Linux, chances are, you already have OpenSSH installed. However, if for some reason OpenSSH is not installed. You can obtain a copy by checking with your distributions package management resource or by visiting https://www.openssh.com/ and following the correct links which correspond to your operating system.