You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
The Enigma machine is a fairly complex cipher machine used by the Germans and others during World War II to encrypt their messages. The Enigma code was famously broken by Alan Turing during the war, using one of the world's first "computers". It is your job to implement this machine.
Step 1, Rotation
Our enigma machine has 3 slots for rotors, and 5 available rotors for each of these slots. Each rotor has 26 different possible positions (from A to Z). Each rotor has a predefined notch position:
Huffman encoding is an algorithm devised by David A. Huffman of MIT in 1952 for compressing text data to make a file occupy a smaller number of bytes. This relatively simple compression algorithm is powerful enough that variations of it are still used today in computer networks, fax machines, modems, HDTV, and other areas. This challenge involves implementing a function that performs Huffman encoding, and one that performs Huffman decoding.
Normally text data is stored in a standard format of 8 bits per character using an encoding called ASCII that maps every character to a binary integer value from 0-255. The idea of Huffman encoding is to abandon the rigid 8-bits-percharacter requirement and use different-length binary encodings for different characters. The advantage of doing this is that if a character occurs frequently in the file, such as the common letter 'e', it could be given a shorter encoding (fewer bits), making the file smaller. The tradeoff is t
In this challenge, you will be writing a piece of code that generates the first N numbers in OEIS sequence A000010, the Euler totient function phi(n).
Definition
This sequence is defined as the "count of numbers <= n and prime to n." In other words, the value of the function for an input
n is the count of numbers in {1, 2, 3, ..., n} that are relatively prime to n-- that is, the numbers whose GCD (Greatest
Common Divisor) with n is 1.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters