Tag Archives: math

(PHP) Fibonacci series (several different algorithms)

Planning to add proper PHPunit and PHPlogger code examples and blog about it at http://bcmoney-mobiletv.com/blog/

Posted in PHP | Also tagged , , , , , , | Leave a comment

(Python) Simple XOR Hash

This is a simple hash that pads its input to the block size and XORs every block together. Output is in hexadecimal octets.

Posted in Python | Also tagged , , , , , , | Leave a comment

(C++) Gaussian Elimination

Numerical Methods application for solving system of equation using Gaussian Elimination based on this Wikipedia article: http://en.wikipedia.org/wiki/Gaussian_elimination

Posted in C++ | Also tagged , , , , , , , | Leave a comment

Primality testing with Fermat’s little theorem and Miller-Rabin in C#

Prime numbers have many applications. For example, in cryptography. The RSA algorithm for public-key cryptography uses large prime numbers for generating keys. Quote: The RSA algorithm works as follows: take two large primes, p and q, and compute their product n = pq; n is called the modulus. Choose a number, e, less than n [...]

Posted in C# | Also tagged , , , , , , , , , , , , , , , , | 2 Comments

(Java) Fun with Fibonacci, Golden Ratio and Factorials, with loops vs recursives

 

Posted in Java | Also tagged , , , , , , , | Leave a comment

(C#) Prime Number Generator

 

Posted in C# | Also tagged , , , , , , | Leave a comment

2D and 3D vector normalization and angle calculation in C++

Normalizing a vector can derive the direction of the vector in 2D or 3D space. A normalized vector is also known as a unit vector. We’re going to normalize and calculate the angles of a 2D vector at position (5,5) and a 3D vector at position (5,5,5). This can come in very handy when, for [...]

Posted in C++ | Also tagged , , , , , , , , , , , , , , , , , , , , , , , | 2 Comments

Fibonacci sequence in Haskell

The fibonacci sequence has many applications , such as paintings , predicting stock market changes and even sunflowers. This example illustrates the fibonacci sequence in Haskell.

Posted in Haskell | Also tagged , , , , , , | Leave a comment

Drawing circles with JavaScript and HTML5 Canvas

The HTML5 specification includes the canvas element for drawing graphics with JavaScript. This example demonstrates the use of the canvas element and JavaScript for drawing circles.

Posted in JavaScript | Also tagged , , , , , , , , , , , | 3 Comments