Compare commits
No commits in common. "main" and "renovate/configure" have entirely different histories.
main
...
renovate/c
3
.czrc
|
@ -1,3 +0,0 @@
|
|||
{
|
||||
"path": "cz-conventional-changelog"
|
||||
}
|
22
.gitignore
vendored
|
@ -3,25 +3,3 @@ venv
|
|||
private
|
||||
__pycache__
|
||||
*.out
|
||||
node_modules
|
||||
*.csv
|
||||
tmp
|
||||
|
||||
CMakeLists.txt.user
|
||||
CMakeCache.txt
|
||||
CMakeFiles
|
||||
CMakeScripts
|
||||
Testing
|
||||
Makefile
|
||||
cmake_install.cmake
|
||||
install_manifest.txt
|
||||
compile_commands.json
|
||||
CTestTestfile.cmake
|
||||
_deps
|
||||
bin
|
||||
ignored
|
||||
|
||||
*.docx
|
||||
*.pptx
|
||||
*.doc
|
||||
*.pdf
|
||||
|
|
|
@ -1,5 +0,0 @@
|
|||
#!/bin/sh
|
||||
. "$(dirname "$0")/_/husky.sh"
|
||||
|
||||
npx pretty-quick --staged
|
||||
git add .
|
35
.vscode/settings.json
vendored
|
@ -1,36 +1,3 @@
|
|||
{
|
||||
"files.exclude": {
|
||||
"**/.git": true,
|
||||
"**/.svn": true,
|
||||
"**/.hg": true,
|
||||
"**/CVS": true,
|
||||
"**/.DS_Store": true,
|
||||
"**/Thumbs.db": true,
|
||||
"node_modules": true,
|
||||
"challenges/euler/node_modules": true,
|
||||
"challenges/euler/build": true,
|
||||
"commitlint.config.js": true,
|
||||
"**/pnpm-lock.yaml": true
|
||||
},
|
||||
"files.associations": {
|
||||
"*.tcc": "cpp",
|
||||
"complex": "cpp",
|
||||
"fstream": "cpp",
|
||||
"cmath": "cpp",
|
||||
"functional": "cpp",
|
||||
"tuple": "cpp",
|
||||
"type_traits": "cpp",
|
||||
"string_view": "cpp",
|
||||
"vector": "cpp",
|
||||
"algorithm": "cpp",
|
||||
"memory": "cpp",
|
||||
"random": "cpp",
|
||||
"iosfwd": "cpp",
|
||||
"iostream": "cpp",
|
||||
"istream": "cpp",
|
||||
"numeric": "cpp",
|
||||
"ostream": "cpp",
|
||||
"ratio": "cpp",
|
||||
"streambuf": "cpp"
|
||||
}
|
||||
"java.project.sourcePaths": ["java"]
|
||||
}
|
||||
|
|
Before Width: | Height: | Size: 572 KiB |
BIN
assets/dailyprogrammer.gif
Normal file
After Width: | Height: | Size: 636 KiB |
BIN
assets/euler.png
Before Width: | Height: | Size: 75 KiB |
BIN
assets/python.png
Normal file
After Width: | Height: | Size: 80 KiB |
Before Width: | Height: | Size: 1.8 MiB After Width: | Height: | Size: 1.8 MiB |
BIN
assets/ri.jpg
Normal file
After Width: | Height: | Size: 7.4 KiB |
|
@ -1,15 +0,0 @@
|
|||
cmake_minimum_required(VERSION 3.13)
|
||||
project(the-honk)
|
||||
|
||||
set(CMAKE_CXX_STANDARD 14)
|
||||
set(CMAKE_ARCHIVE_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/lib)
|
||||
set(CMAKE_LIBRARY_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/lib)
|
||||
set(CMAKE_RUNTIME_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/bin)
|
||||
|
||||
add_executable(pascal code/pascal.cc)
|
||||
add_executable(babylonian code/babylonian.cc)
|
||||
add_executable(karatsuba code/karatsuba.cc)
|
||||
add_executable(dice code/dice.cc)
|
||||
add_executable(binomialExpansion code/binomialExpansion.cc)
|
||||
add_executable(squareForm code/squareForm.cc)
|
||||
add_executable(nthRoot code/nthRoot.cc)
|
|
@ -1,20 +0,0 @@
|
|||
#include <iostream>
|
||||
|
||||
int sqrt(int number) {
|
||||
int initialGuess = 2;
|
||||
|
||||
while (abs(initialGuess - number / initialGuess) > 1) {
|
||||
initialGuess = (initialGuess + number / initialGuess) / 2;
|
||||
}
|
||||
|
||||
return initialGuess;
|
||||
}
|
||||
|
||||
int main() {
|
||||
std::cout << "Type a number to predict the square root of: ";
|
||||
|
||||
int number;
|
||||
std::cin >> number;
|
||||
|
||||
std::cout << sqrt(number);
|
||||
}
|
|
@ -1,72 +0,0 @@
|
|||
#include <iostream>
|
||||
|
||||
std::string superscript[10] = {"⁰", "¹", "²", "³", "⁴", "⁵", "⁶", "⁷", "⁸", "⁹"};
|
||||
|
||||
int factorial(int number) {
|
||||
int out = 1;
|
||||
|
||||
for (int i = 2; i <= number; i++) {
|
||||
out *= i;
|
||||
}
|
||||
|
||||
return out;
|
||||
}
|
||||
|
||||
int nCr(int n, int r) {
|
||||
return factorial(n) / (factorial(r) * factorial(n - r));
|
||||
}
|
||||
|
||||
std::string formatNomial(int value, std::string nomial) {
|
||||
std::string term = nomial;
|
||||
|
||||
if (value != 1) {
|
||||
std::string power = "";
|
||||
|
||||
for (char & digit : std::to_string(value)) {
|
||||
power += superscript[digit - '0'];
|
||||
}
|
||||
|
||||
term += power;
|
||||
}
|
||||
|
||||
return term;
|
||||
}
|
||||
|
||||
std::string binomialExpansion(int power) {
|
||||
std::string output = "";
|
||||
|
||||
for (int r = 0; r <= power; r++) {
|
||||
int a = power - r;
|
||||
int c = nCr(power, r);
|
||||
std::string term = "";
|
||||
|
||||
if (c != 1) {
|
||||
term += std::to_string(c);
|
||||
}
|
||||
|
||||
if (a != 0) {
|
||||
term += formatNomial(a, "a");
|
||||
}
|
||||
|
||||
if (r != 0) {
|
||||
term += formatNomial(r, "b");
|
||||
}
|
||||
|
||||
if (r != 0) {
|
||||
output += " + " + term;
|
||||
} else {
|
||||
output += term;
|
||||
}
|
||||
}
|
||||
|
||||
return output;
|
||||
}
|
||||
|
||||
int main() {
|
||||
std::cout << "(a + b)ⁿ\nPlease input a value for n! ";
|
||||
|
||||
int n;
|
||||
std::cin >> n;
|
||||
|
||||
std::cout << binomialExpansion(n);
|
||||
}
|
|
@ -1,66 +0,0 @@
|
|||
#include <iostream>
|
||||
#include <vector>
|
||||
|
||||
class Dice {
|
||||
private:
|
||||
int randomInteger(int lowerBound, int upperBound) {
|
||||
return rand() % (upperBound - lowerBound - 1) + 1;
|
||||
}
|
||||
|
||||
public:
|
||||
int sides;
|
||||
|
||||
// Constructor
|
||||
Dice(int sideNum) {
|
||||
// Set the number of sides
|
||||
sides = sideNum;
|
||||
}
|
||||
|
||||
// Roll the dice
|
||||
int roll() {
|
||||
return randomInteger(1, sides);
|
||||
}
|
||||
|
||||
// Roll the dice many times and return thre result in a vector
|
||||
std::vector<int> rollMany(int times) {
|
||||
std::vector<int> rolls{};
|
||||
|
||||
for (int i = 0; i < times; i++) {
|
||||
int rolled = roll();
|
||||
rolls.push_back(rolled);
|
||||
}
|
||||
|
||||
return rolls;
|
||||
}
|
||||
};
|
||||
|
||||
// Print a vector of integers onto one line
|
||||
void printResults(std::vector<int> data) {
|
||||
int length = data.size();
|
||||
|
||||
for (int i = 0; i < length; i++) {
|
||||
std::string out = std::to_string(data[i]);
|
||||
if (i != length - 1) out += ", ";
|
||||
|
||||
std::cout << out;
|
||||
}
|
||||
}
|
||||
|
||||
int main() {
|
||||
// Seed the RNG
|
||||
srand((unsigned)time(nullptr));
|
||||
|
||||
// Instantiate the dice
|
||||
Dice six(6);
|
||||
Dice twenty(20);
|
||||
|
||||
// Roll them
|
||||
std::vector<int> sixRolled = six.rollMany(10);
|
||||
std::vector<int> twentyRolled = twenty.rollMany(10);
|
||||
|
||||
// Display their outputs
|
||||
std::cout << "Six Sided Dice:\n";
|
||||
printResults(sixRolled);
|
||||
std::cout << "\n\nTwenty Sided Dice:\n";
|
||||
printResults(twentyRolled);
|
||||
}
|
|
@ -1,57 +0,0 @@
|
|||
#include <iostream>
|
||||
#include <math.h>
|
||||
#include <chrono>
|
||||
|
||||
typedef std::chrono::high_resolution_clock Clock;
|
||||
typedef Clock::time_point ClockTime;
|
||||
|
||||
double karatsuba(double num1, double num2) {
|
||||
int num1Length = std::to_string((int)num1).size();
|
||||
int num2Length = std::to_string((int)num2).size();
|
||||
|
||||
// Fallback to traditional multiplication
|
||||
if (num1Length == 1 || num2Length == 1) {
|
||||
return num1 * num2;
|
||||
} else {
|
||||
double n = floor(std::max(num1Length, num2Length) / 2);
|
||||
|
||||
double lowNum1 = fmod(num1, pow(10, n));
|
||||
double lowNum2 = fmod(num2, pow(10, n));
|
||||
|
||||
double highNum1 = floor(num1 / pow(10, n));
|
||||
double highNum2 = floor(num2 / pow(10, n));
|
||||
|
||||
double z0 = karatsuba(lowNum1, lowNum2);
|
||||
double z1 = karatsuba(lowNum1 + highNum1, lowNum2 + highNum2);
|
||||
double z2 = karatsuba(highNum1, highNum2);
|
||||
|
||||
return (z2 * pow(10, n * 2)) + ((z1 - z2 - z0) * pow(10, n)) + z0;
|
||||
}
|
||||
}
|
||||
|
||||
int main() {
|
||||
std::cout << "Give me a number! ";
|
||||
|
||||
double num1;
|
||||
std::cin >> num1;
|
||||
|
||||
std::cout << "Give me a number to multiply " + std::to_string(num1) + " by! ";
|
||||
|
||||
double num2;
|
||||
std::cin >> num2;
|
||||
|
||||
ClockTime karatsubaBegin, karatsubaEnd;
|
||||
karatsubaBegin = Clock::now();
|
||||
double karatsubaResult = karatsuba(num1, num2);
|
||||
karatsubaEnd = Clock::now();
|
||||
double karatsubaTime = std::chrono::duration_cast<std::chrono::nanoseconds>(karatsubaEnd - karatsubaBegin).count();
|
||||
|
||||
ClockTime quadraticBegin, quadraticEnd;
|
||||
quadraticBegin = Clock::now();
|
||||
double quadraticResult = num1 * num2;
|
||||
quadraticEnd = Clock::now();
|
||||
double quadraticTime = std::chrono::duration_cast<std::chrono::nanoseconds>(quadraticEnd - quadraticBegin).count();
|
||||
|
||||
std::cout << "\nQuadratic Result: " << quadraticResult << " (" << quadraticTime << "ns)\n";
|
||||
std::cout << "Karatsuba Result: " << karatsubaResult << " (" << karatsubaTime << "ns)";
|
||||
}
|
|
@ -1,105 +0,0 @@
|
|||
#include <iostream>
|
||||
#include <cmath>
|
||||
#include <limits>
|
||||
|
||||
std::string superscript[10] = { "⁰", "¹", "²", "³", "⁴", "⁵", "⁶", "⁷", "⁸", "⁹" };
|
||||
|
||||
struct Result {
|
||||
double result;
|
||||
int maxIterations;
|
||||
int iterationsUsed;
|
||||
};
|
||||
|
||||
// See https://github.com/newtykins/the-honk/tree/main/maths/nth%20root.png
|
||||
Result nthRoot(double n, double x, int maxIterations = 200) {
|
||||
Result output;
|
||||
output.result = 1;
|
||||
output.maxIterations = maxIterations;
|
||||
output.iterationsUsed = 0;
|
||||
|
||||
double lastIteration = 0;
|
||||
|
||||
for (int i = 0; i < maxIterations; i++) {
|
||||
if (lastIteration == output.result) {
|
||||
break;
|
||||
}
|
||||
|
||||
output.iterationsUsed += 1;
|
||||
lastIteration = output.result;
|
||||
output.result = ((lastIteration * (n - 1)) + (x * std::pow(lastIteration, 1 - n))) / n;
|
||||
}
|
||||
|
||||
return output;
|
||||
}
|
||||
|
||||
int fetchInput(std::string letter) {
|
||||
std::cout << "Please input a value for " + letter + ": ";
|
||||
|
||||
double input;
|
||||
std::cin >> input;
|
||||
|
||||
return input;
|
||||
}
|
||||
|
||||
bool isInt(double n) {
|
||||
return (int) n == n;
|
||||
}
|
||||
|
||||
std::string formatDouble(double input) {
|
||||
std::string str = std::to_string(input);
|
||||
str.erase(str.find_last_not_of('0') + 1, std::string::npos);
|
||||
return str;
|
||||
}
|
||||
|
||||
std::string formatRadical(double n, double x) {
|
||||
std::string formattedN = "";
|
||||
std::string formattedX = "";
|
||||
|
||||
if (isInt(n)) {
|
||||
std::string nString = std::to_string((int) n);
|
||||
|
||||
for (int i = 0; i < nString.length(); i++) {
|
||||
int digit = (int) nString[i] - 48;
|
||||
formattedN += superscript[digit];
|
||||
}
|
||||
} else {
|
||||
std::string nString = formatDouble(n);
|
||||
|
||||
for (int i = 0; i < nString.length(); i++) {
|
||||
try {
|
||||
int digit = (int) nString[i] - 48;
|
||||
formattedN += superscript[digit];
|
||||
} catch (const std::exception) {
|
||||
formattedN += "˙";
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (isInt(x)) {
|
||||
formattedX = std::to_string((int) x);
|
||||
} else {
|
||||
formattedX = formatDouble(x);
|
||||
}
|
||||
|
||||
return formattedN + "√" + formattedX;
|
||||
}
|
||||
|
||||
int main() {
|
||||
std::cout << "ⁿ√x\n";
|
||||
|
||||
double n = fetchInput("n");
|
||||
double x = fetchInput("x");
|
||||
|
||||
std::cout << "Please enter an amount of iterations to perform: ";
|
||||
|
||||
int iterations;
|
||||
std::cin >> iterations;
|
||||
|
||||
// Make sure that cout prints to the highest precision possible
|
||||
std::cout.precision(std::numeric_limits<double>::max_digits10);
|
||||
|
||||
Result root = nthRoot(n, x, iterations);
|
||||
|
||||
std::cout << "\n" << formatRadical(n, x) << " = " << root.result << "\n";
|
||||
std::cout << "Used " << root.iterationsUsed << " out of " << root.maxIterations << " iterations (:";
|
||||
}
|
|
@ -1,77 +0,0 @@
|
|||
#include <iostream>
|
||||
#include <vector>
|
||||
|
||||
// Calculate Pascal's triangle
|
||||
std::vector<std::vector<long long>> pascal(int rowCount) {
|
||||
std::vector<std::vector<long long>> rows{{1}};
|
||||
|
||||
for (int i = 0; i < rowCount; i++) {
|
||||
std::vector<long long> previousRow = rows[rows.size() - 1];
|
||||
std::vector<long long> newRow{1};
|
||||
|
||||
for (int j = 0; j < previousRow.size() - 1; j++) {
|
||||
newRow.push_back(previousRow[j] + previousRow[j + 1]);
|
||||
}
|
||||
|
||||
newRow.push_back(1);
|
||||
rows.push_back(newRow);
|
||||
}
|
||||
|
||||
return rows;
|
||||
}
|
||||
|
||||
// Find the length of a vector if it were outputted as a string with a space between each value
|
||||
int vectorStringLength(std::vector<long long> vector) {
|
||||
int value = vector.size();
|
||||
|
||||
for (int i = 0; i < vector.size(); i++) {
|
||||
value += std::to_string(vector[i]).size();
|
||||
}
|
||||
|
||||
return value;
|
||||
}
|
||||
|
||||
// Draw Pascal's Triangle
|
||||
void drawPascalTriangle(int rowCount) {
|
||||
std::vector<std::vector<long long>> pascalsTriangle = pascal(rowCount);
|
||||
int bottomRowSize = vectorStringLength(pascalsTriangle[pascalsTriangle.size() - 1]);
|
||||
|
||||
for (int i = 0; i < pascalsTriangle.size() - 1; i++) {
|
||||
std::vector<long long> currentRow = pascalsTriangle[i];
|
||||
|
||||
int rowSize = vectorStringLength(currentRow);
|
||||
|
||||
int sizeDifference = bottomRowSize - rowSize;
|
||||
|
||||
std::string spacing = "";
|
||||
|
||||
for (int j = 0; j < sizeDifference / 2; j++) {
|
||||
spacing += " ";
|
||||
}
|
||||
|
||||
for (int j = 0; j < currentRow.size(); j++) {
|
||||
if (j == 0) {
|
||||
std::cout << spacing;
|
||||
}
|
||||
|
||||
std::cout << std::to_string(currentRow[j]) + " ";
|
||||
|
||||
if (j == currentRow.size() - 1) {
|
||||
std::cout << spacing;
|
||||
}
|
||||
}
|
||||
|
||||
if (i != pascalsTriangle.size() - 1) {
|
||||
std::cout << "\n";
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
int main() {
|
||||
std::cout << "How many rows of Pascal's Triangle would you like to calculate? ";
|
||||
|
||||
int rowCount;
|
||||
std::cin >> rowCount;
|
||||
|
||||
drawPascalTriangle(rowCount);
|
||||
}
|
|
@ -1,98 +0,0 @@
|
|||
#include <iostream>
|
||||
|
||||
double power(double base, double exponent) {
|
||||
double out = base;
|
||||
|
||||
for (int i = 1; i < exponent; i++) {
|
||||
out *= base;
|
||||
}
|
||||
|
||||
return out;
|
||||
}
|
||||
|
||||
// Euclid algorithm
|
||||
int greatestCommonDivisor(int a, int b) {
|
||||
int currentA = abs(a);
|
||||
int currentB = abs(b);
|
||||
|
||||
while (currentA != currentB) {
|
||||
if (currentA > currentB) {
|
||||
currentA -= currentB;
|
||||
}
|
||||
|
||||
if (currentB > currentA) {
|
||||
currentB -= currentA;
|
||||
}
|
||||
}
|
||||
|
||||
return currentA;
|
||||
}
|
||||
|
||||
// Simplify and then format a fraction
|
||||
std::string formatFraction(int numerator, int denominator) {
|
||||
int gcd = greatestCommonDivisor(numerator, denominator);
|
||||
int n = numerator / gcd;
|
||||
int d = denominator / gcd;
|
||||
|
||||
if (d == 1) {
|
||||
return std::to_string(n);
|
||||
} else {
|
||||
// Fraction unicode
|
||||
return std::to_string(n) + "\u2044" + std::to_string(d);
|
||||
}
|
||||
}
|
||||
|
||||
// Format a double by cutting off as many trailing zeros as possible
|
||||
std::string formatDouble(double input) {
|
||||
std::string str = std::to_string(input);
|
||||
str.erase(str.find_last_not_of('0') + 1, std::string::npos);
|
||||
return str;
|
||||
}
|
||||
|
||||
// ax² + b^x + c^x -> a(x + p) + q
|
||||
std::string completeTheSquare(double a, double b, double c) {
|
||||
// Calculate relevant values
|
||||
double p = b / (2 * a);
|
||||
double q = c - (power(b, 2) / 4 * a);
|
||||
std::string output = "(x";
|
||||
|
||||
// Add the p value
|
||||
if (p != 0) {
|
||||
std::string sign = p > 0 ? "+" : "-";
|
||||
output += " " + sign + " " + formatFraction(b, 2 * a) + ")²";
|
||||
} else {
|
||||
output += ")²";
|
||||
}
|
||||
|
||||
// Add the q value
|
||||
if (q != 0) {
|
||||
std::string sign = q > 0 ? "+" : "-";
|
||||
output += " " + sign + " " + formatDouble(q);
|
||||
}
|
||||
|
||||
// Add the coefficient if relevant
|
||||
if (a > 1) {
|
||||
output.insert(0, formatDouble(a));
|
||||
}
|
||||
|
||||
return output;
|
||||
}
|
||||
|
||||
int promptForInteger(std::string letter) {
|
||||
std::cout << "Please input a value for " + letter + ": ";
|
||||
|
||||
int input;
|
||||
std::cin >> input;
|
||||
|
||||
return input;
|
||||
}
|
||||
|
||||
int main() {
|
||||
std::cout << "ax² + bx + c -> a(x + p)² + q\n";
|
||||
|
||||
int a = promptForInteger("a");
|
||||
int b = promptForInteger("b");
|
||||
int c = promptForInteger("c");
|
||||
|
||||
std::cout << completeTheSquare(a, b, c);
|
||||
}
|
0
c/algorithms/binary-search.c
Normal file
9
c/calculators/helpers/factorial.c
Normal file
|
@ -0,0 +1,9 @@
|
|||
int factorial(int n) {
|
||||
int ans = 1;
|
||||
|
||||
for (int i = 2; i <= n; i++) {
|
||||
ans *= i;
|
||||
}
|
||||
|
||||
return ans;
|
||||
}
|
20
c/calculators/ncr.c
Normal file
|
@ -0,0 +1,20 @@
|
|||
#include <stdio.h>
|
||||
#include "helpers/factorial.c"
|
||||
|
||||
int nCr(int n, int r) {
|
||||
return factorial(n) / factorial(r) * factorial(n - r);
|
||||
}
|
||||
|
||||
void main() {
|
||||
int n;
|
||||
int r;
|
||||
|
||||
printf("Please enter n: ");
|
||||
scanf("%i", &n);
|
||||
|
||||
printf("Please enter r: ");
|
||||
scanf("%i", &r);
|
||||
|
||||
int ans = nCr(n, r);
|
||||
printf("The answer is: %i", ans);
|
||||
}
|
|
@ -1,2 +0,0 @@
|
|||
// todo: custom commitlint types
|
||||
module.exports = { extends: ['@commitlint/config-conventional'] };
|
16
daily-programmer/#390 - Number of 1s.py
Normal file
|
@ -0,0 +1,16 @@
|
|||
def count1(n):
|
||||
x = str(n)
|
||||
count = 0
|
||||
for index, digit in enumerate(x[::-1]):
|
||||
digit = int(digit)
|
||||
if digit != 0:
|
||||
if digit == 1:
|
||||
numberAfter = x[len(x) - index:] or '0'
|
||||
count += int(numberAfter) + 1
|
||||
else:
|
||||
count += 10 ** index
|
||||
count += int(10 ** (index - 1) * index * digit)
|
||||
return count
|
||||
|
||||
|
||||
print(count1(3**35))
|
14
daily-programmer/#391 - ABACABA.py
Normal file
|
@ -0,0 +1,14 @@
|
|||
from string import ascii_lowercase
|
||||
|
||||
def abacaba(n):
|
||||
output = ''
|
||||
currLetter = 0
|
||||
for i in range(n):
|
||||
output = '{0}{1}{2}'.format(output, ascii_lowercase[currLetter], output)
|
||||
currLetter = currLetter + 1
|
||||
if currLetter > 25:
|
||||
currLetter = 0
|
||||
return output
|
||||
|
||||
out = abacaba(10)
|
||||
print(out)
|
16
daily-programmer/#393 - Making Change.py
Normal file
|
@ -0,0 +1,16 @@
|
|||
COINTYPES = [500, 100, 25, 10, 5, 1]
|
||||
|
||||
class Change():
|
||||
def __init__(self, value):
|
||||
self.value = value # Save the value
|
||||
self.coins = {} # Create a dictionary for the coins
|
||||
curr = value # Make a temporary variable to alter
|
||||
for TYPE in COINTYPES: # For each coin type
|
||||
index = COINTYPES.index(TYPE) # Get the index
|
||||
if index > 0: # If the coin type is not at the first index
|
||||
curr = curr % COINTYPES[index - 1] # Work out the remainder
|
||||
self.coins[TYPE] = curr // TYPE # And work out how many of the coin type fits into that remainder
|
||||
self.total = sum(self.coins.values()) # How many coins are there in total?
|
||||
|
||||
change = Change(123456)
|
||||
print(change.coins, change.total)
|
16
daily-programmer/readme.md
Normal file
|
@ -0,0 +1,16 @@
|
|||
<div align="center">
|
||||
<img height="256" src="../../assets/dailyprogrammer.gif" alt="">
|
||||
<h1>r/dailyprogrammer</h1>
|
||||
</div>
|
||||
|
||||
[The Subreddit](https://reddit.com/r/dailyprogrammer)
|
||||
|
||||
- #390 - Number of 1s
|
||||
- [Solution](%23390%20-%20Number%20of%201s.py)
|
||||
- [Reddit Post](https://www.reddit.com/r/dailyprogrammer/comments/neg49j/20210517_challenge_390_difficult_number_of_1s/)
|
||||
- #391 - ABACABA
|
||||
- [Solution](%23391%20-%20ABACABA.py)
|
||||
- [Reddit Post](https://www.reddit.com/r/dailyprogrammer/comments/njxq95/20210524_challenge_391_easy_the_abacaba_sequence/)
|
||||
- #393 - Making Change
|
||||
- [Solution](%23393%20-%20Making%20Change.py)
|
||||
- [Reddit Post](https://www.reddit.com/r/dailyprogrammer/comments/nucsik/20210607_challenge_393_easy_making_change/)
|
4
euler/.gitignore
vendored
Normal file
|
@ -0,0 +1,4 @@
|
|||
node_modules
|
||||
.yarn/cache
|
||||
.yarn/install-state.gz
|
||||
build
|
2
euler/.yarnrc.yml
Normal file
|
@ -0,0 +1,2 @@
|
|||
yarnPath: .yarn/releases/yarn-3.1.0.cjs
|
||||
nodeLinker: node-modules
|
16
euler/_pythonarchive/1 - Multiples of 3 or 5.py
Normal file
|
@ -0,0 +1,16 @@
|
|||
below = 1000
|
||||
multiplesOf = [3,5]
|
||||
toAdd = []
|
||||
|
||||
for i in range(1, below):
|
||||
for num in multiplesOf:
|
||||
if i % num == 0:
|
||||
toAdd.append(i)
|
||||
|
||||
toAdd = list(dict.fromkeys(toAdd))
|
||||
total = 0
|
||||
|
||||
for i in toAdd:
|
||||
total += i
|
||||
|
||||
print(total)
|
13
euler/_pythonarchive/2 - Even Fibonacci numbers.py
Normal file
|
@ -0,0 +1,13 @@
|
|||
sequence = [1, 2]
|
||||
|
||||
while sequence[len(sequence) - 1] < 4000000:
|
||||
sequence.append(sequence[len(sequence) - 1] + sequence[len(sequence) - 2])
|
||||
sequence.pop()
|
||||
|
||||
total = 0
|
||||
|
||||
for i in sequence:
|
||||
if i % 2 == 0:
|
||||
total += i
|
||||
|
||||
print(total)
|
10
euler/_pythonarchive/3 - Largest prime factor.py
Normal file
|
@ -0,0 +1,10 @@
|
|||
n = 600851475143
|
||||
i = 2
|
||||
|
||||
while i * i <= n:
|
||||
if n % i:
|
||||
i += 1
|
||||
else:
|
||||
n //= i
|
||||
|
||||
print(n)
|
19
euler/gulpfile.js
Normal file
|
@ -0,0 +1,19 @@
|
|||
const gulp = require('gulp');
|
||||
const typescript = require('gulp-typescript');
|
||||
const uglify = require('gulp-uglify');
|
||||
const rename = require('gulp-rename');
|
||||
|
||||
gulp.task('build', () => {
|
||||
const tsc = typescript.createProject('tsconfig.json');
|
||||
|
||||
return gulp
|
||||
.src('src/**/*.ts')
|
||||
.pipe(tsc())
|
||||
.pipe(uglify({ mangle: { toplevel: true } }))
|
||||
.pipe(
|
||||
rename(path => {
|
||||
path.basename = path.basename.split('-')[0].trim();
|
||||
})
|
||||
)
|
||||
.pipe(gulp.dest('build'));
|
||||
});
|
18
euler/package.json
Normal file
|
@ -0,0 +1,18 @@
|
|||
{
|
||||
"name": "project-euler",
|
||||
"scripts": {
|
||||
"build": "gulp build",
|
||||
"start": "node run"
|
||||
},
|
||||
"devDependencies": {
|
||||
"@types/node": "^16.11.6",
|
||||
"chalk": "^4.1.2",
|
||||
"execution-time": "^1.4.1",
|
||||
"gulp": "^4.0.2",
|
||||
"gulp-cli": "^2.3.0",
|
||||
"gulp-rename": "^2.0.0",
|
||||
"gulp-typescript": "^6.0.0-alpha.1",
|
||||
"gulp-uglify": "^3.0.2",
|
||||
"typescript": "^4.4.4"
|
||||
}
|
||||
}
|
2281
euler/pnpm-lock.yaml
Normal file
58
euler/run.js
Normal file
|
@ -0,0 +1,58 @@
|
|||
const fs = require('fs');
|
||||
const chalk = require('chalk');
|
||||
const { spawnSync } = require('child_process');
|
||||
const perf = require('execution-time')();
|
||||
|
||||
const run = (file, puzzleName) => {
|
||||
// Calculate the length of the divider for the puzzle
|
||||
let divider = '--';
|
||||
|
||||
for (let j = 0; j < puzzleName.length; j++) {
|
||||
divider += '-';
|
||||
}
|
||||
|
||||
// Styling
|
||||
console.log(divider);
|
||||
console.log(chalk.bold(chalk.greenBright(puzzleName)));
|
||||
console.log(divider);
|
||||
|
||||
// Execute the file
|
||||
perf.start();
|
||||
spawnSync('node', [`build/${file}`], { shell: true, stdio: 'inherit' });
|
||||
const results = perf.stop();
|
||||
|
||||
// Print time results
|
||||
console.log();
|
||||
console.log(chalk.bold(chalk.yellow(`Executed in ${results.words}`)));
|
||||
};
|
||||
|
||||
// Get files
|
||||
const tsFiles = fs
|
||||
.readdirSync('src')
|
||||
.filter(f => f.endsWith('.ts'))
|
||||
.filter(f => f !== 'utils.ts');
|
||||
const jsFiles = fs
|
||||
.readdirSync('build')
|
||||
.filter(f => f.endsWith('.js'))
|
||||
.filter(f => f !== 'utils.js');
|
||||
|
||||
try {
|
||||
// Extract the puzzle number
|
||||
const puzzleNumber = process.argv[2];
|
||||
if (isNaN(puzzleNumber)) throw Error();
|
||||
|
||||
// Find the associated puzzle
|
||||
const tsFile = tsFiles.filter(f => f.startsWith(puzzleNumber))[0];
|
||||
const puzzleName = tsFile.split('.ts')[0];
|
||||
|
||||
run(`${puzzleNumber}.js`, puzzleName);
|
||||
} catch (error) {
|
||||
for (let i = 0; i < jsFiles.length; i++) {
|
||||
const file = jsFiles[i];
|
||||
const tsFile = tsFiles[i];
|
||||
const puzzleName = tsFile.split('.ts')[0];
|
||||
|
||||
run(file, puzzleName);
|
||||
console.log();
|
||||
}
|
||||
}
|
15
euler/src/1 - Multiples of 3 or 5.ts
Normal file
|
@ -0,0 +1,15 @@
|
|||
export {};
|
||||
|
||||
const calcSum = (numbers: number[]) => numbers.reduce((a, b) => a + b);
|
||||
|
||||
const multiplesOf = (numbers: number[], upperBound: number) => {
|
||||
const results: Set<number> = new Set();
|
||||
|
||||
for (let i = 1; i < upperBound; i++) {
|
||||
numbers.forEach(num => (i % num == 0 ? results.add(i) : null));
|
||||
}
|
||||
|
||||
return Array.from(results);
|
||||
};
|
||||
|
||||
console.log(calcSum(multiplesOf([3, 5], 1000)));
|
35
euler/src/10 - Sumation of Primes.ts
Normal file
|
@ -0,0 +1,35 @@
|
|||
export {};
|
||||
|
||||
const calcSum = (numbers: number[]) => numbers.reduce((a, b) => a + b);
|
||||
|
||||
// Sieve of Eratosthenes time!!!
|
||||
const sumOfPrimes = (upperBound: number) => {
|
||||
let array: boolean[] = [];
|
||||
let upperLimit = Math.sqrt(upperBound);
|
||||
let output: number[] = [];
|
||||
|
||||
// Make an array from 2 to (n - 1) of truthy values
|
||||
for (var i = 0; i < upperBound; i++) {
|
||||
array.push(true);
|
||||
}
|
||||
|
||||
// Remove multiples of primes starting from 2, 3, 5,...
|
||||
for (var i = 2; i <= upperLimit; i++) {
|
||||
if (array[i]) {
|
||||
for (var j = i * i; j < upperBound; j += i) {
|
||||
array[j] = false;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// All array[i] set to true are primes
|
||||
for (var i = 2; i < upperBound; i++) {
|
||||
if (array[i]) {
|
||||
output.push(i);
|
||||
}
|
||||
}
|
||||
|
||||
return calcSum(output);
|
||||
};
|
||||
|
||||
console.log(sumOfPrimes(2000000));
|
79
euler/src/11 - Largest Product in a Grid.ts
Normal file
|
@ -0,0 +1,79 @@
|
|||
// What is the greatest product of four adjacent numbers in the same direction (up, down, left, right, or diagonally) in the 20×20 grid?
|
||||
export {};
|
||||
|
||||
const largestProductInGrid = (grid: number[][], adjacentDigits: number) => {
|
||||
let answer = 0;
|
||||
let product = 0;
|
||||
|
||||
for (let i = 0; i < grid.length; i++) {
|
||||
const row = grid[i];
|
||||
|
||||
for (let j = 0; j < row.length; j++) {
|
||||
if (j < row.length - adjacentDigits - 1) {
|
||||
// Horizontal
|
||||
product = grid[i][j];
|
||||
|
||||
for (let k = 1; k < adjacentDigits; k++) {
|
||||
product *= grid[i][j + k];
|
||||
}
|
||||
}
|
||||
if (i < grid.length - adjacentDigits - 1) {
|
||||
// Vertical
|
||||
product = grid[i][j];
|
||||
|
||||
for (let k = 1; k < adjacentDigits; k++) {
|
||||
product *= grid[i + k][j];
|
||||
}
|
||||
|
||||
// Diagonally to the right
|
||||
if (j < row.length - adjacentDigits - 1) {
|
||||
product = grid[i][j];
|
||||
|
||||
for (let k = 1; k < adjacentDigits; k++) {
|
||||
product *= grid[i + k][j + k];
|
||||
}
|
||||
}
|
||||
|
||||
// Diagonally to the left
|
||||
if (j > adjacentDigits - 1) {
|
||||
product = grid[i][j];
|
||||
|
||||
for (let k = 1; k < adjacentDigits; k++) {
|
||||
product *= grid[i + k][j - k];
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
answer = product > answer ? product : answer;
|
||||
}
|
||||
}
|
||||
return answer;
|
||||
};
|
||||
|
||||
console.log(
|
||||
largestProductInGrid(
|
||||
[
|
||||
[8, 2, 22, 97, 38, 15, 0, 40, 0, 75, 4, 5, 7, 78, 52, 12, 50, 77, 91, 8],
|
||||
[49, 49, 99, 40, 17, 81, 18, 57, 60, 87, 17, 40, 98, 43, 69, 48, 4, 56, 62, 0],
|
||||
[81, 49, 31, 73, 55, 79, 14, 29, 93, 71, 40, 67, 53, 88, 30, 3, 49, 13, 36, 65],
|
||||
[52, 70, 95, 23, 4, 60, 11, 42, 69, 24, 68, 56, 1, 32, 56, 71, 37, 2, 36, 91],
|
||||
[22, 31, 16, 71, 51, 67, 63, 89, 41, 92, 36, 54, 22, 40, 40, 28, 66, 33, 13, 80],
|
||||
[24, 47, 32, 60, 99, 3, 45, 2, 44, 75, 33, 53, 78, 36, 84, 20, 35, 17, 12, 50],
|
||||
[32, 98, 81, 28, 64, 23, 67, 10, 26, 38, 40, 67, 59, 54, 70, 66, 18, 38, 64, 70],
|
||||
[67, 26, 20, 68, 2, 62, 12, 20, 95, 63, 94, 39, 63, 8, 40, 91, 66, 49, 94, 21],
|
||||
[24, 55, 58, 5, 66, 73, 99, 26, 97, 17, 78, 78, 96, 83, 14, 88, 34, 89, 63, 72],
|
||||
[21, 36, 23, 9, 75, 0, 76, 44, 20, 45, 35, 14, 0, 61, 33, 97, 34, 31, 33, 95],
|
||||
[78, 17, 53, 28, 22, 75, 31, 67, 15, 94, 3, 80, 4, 62, 16, 14, 9, 53, 56, 92],
|
||||
[16, 39, 5, 42, 96, 35, 31, 47, 55, 58, 88, 24, 0, 17, 54, 24, 36, 29, 85, 57],
|
||||
[86, 56, 0, 48, 35, 71, 89, 7, 5, 44, 44, 37, 44, 60, 21, 58, 51, 54, 17, 58],
|
||||
[19, 80, 81, 68, 5, 94, 47, 69, 28, 73, 92, 13, 86, 52, 17, 77, 4, 89, 55, 40],
|
||||
[4, 52, 8, 83, 97, 35, 99, 16, 7, 97, 57, 32, 16, 26, 26, 79, 33, 27, 98, 66],
|
||||
[88, 36, 68, 87, 57, 62, 20, 72, 3, 46, 33, 67, 46, 55, 12, 32, 63, 93, 53, 69],
|
||||
[4, 42, 16, 73, 38, 25, 39, 11, 24, 94, 72, 18, 8, 46, 29, 32, 40, 62, 76, 36],
|
||||
[20, 69, 36, 41, 72, 30, 23, 88, 34, 62, 99, 69, 82, 67, 59, 85, 74, 4, 36, 16],
|
||||
[20, 73, 35, 29, 78, 31, 90, 1, 74, 31, 49, 71, 48, 86, 81, 16, 23, 57, 5, 54],
|
||||
[1, 70, 54, 71, 83, 51, 54, 69, 16, 92, 33, 48, 61, 43, 52, 1, 89, 19, 67, 48]
|
||||
],
|
||||
4
|
||||
)
|
||||
);
|
39
euler/src/12 - Highly Divisible Triangular Number.ts
Normal file
|
@ -0,0 +1,39 @@
|
|||
export {};
|
||||
|
||||
const factorsOf = (num: number) => {
|
||||
const isEven = num % 2 === 0;
|
||||
const max = Math.sqrt(num);
|
||||
const inc = isEven ? 1 : 2;
|
||||
const factors = [1, num];
|
||||
|
||||
for (let curFactor = isEven ? 2 : 3; curFactor <= max; curFactor += inc) {
|
||||
if (num % curFactor !== 0) continue;
|
||||
factors.push(curFactor);
|
||||
|
||||
let compliment = num / curFactor;
|
||||
if (compliment !== curFactor) factors.push(compliment);
|
||||
}
|
||||
|
||||
return factors;
|
||||
};
|
||||
|
||||
// https://www.mathsisfun.com/algebra/triangular-numbers.html
|
||||
const nthTriangleNumber = (n: number) => (n * (n + 1)) / 2;
|
||||
|
||||
const firstTriangleWithOverNDivisors = (n: number) => {
|
||||
let divisorCountFound = false;
|
||||
let i = 1;
|
||||
|
||||
while (!divisorCountFound) {
|
||||
const triangle = nthTriangleNumber(i);
|
||||
const factors = [...factorsOf(triangle)];
|
||||
i++;
|
||||
|
||||
if (factors.length > n) {
|
||||
divisorCountFound = true;
|
||||
return triangle;
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
console.log(firstTriangleWithOverNDivisors(500));
|
112
euler/src/13 - Large Sum.ts
Normal file
|
@ -0,0 +1,112 @@
|
|||
export {};
|
||||
|
||||
const calcSum = (numbers: number[]) => numbers.reduce((a, b) => a + b);
|
||||
const firstXDigits = (number: number, x: number) => BigInt(number).toString().substr(0, x);
|
||||
|
||||
console.log(
|
||||
firstXDigits(
|
||||
calcSum([
|
||||
37107287533902102798797998220837590246510135740250,
|
||||
46376937677490009712648124896970078050417018260538,
|
||||
74324986199524741059474233309513058123726617309629,
|
||||
91942213363574161572522430563301811072406154908250,
|
||||
23067588207539346171171980310421047513778063246676,
|
||||
89261670696623633820136378418383684178734361726757,
|
||||
28112879812849979408065481931592621691275889832738,
|
||||
44274228917432520321923589422876796487670272189318,
|
||||
47451445736001306439091167216856844588711603153276,
|
||||
70386486105843025439939619828917593665686757934951,
|
||||
62176457141856560629502157223196586755079324193331,
|
||||
64906352462741904929101432445813822663347944758178,
|
||||
92575867718337217661963751590579239728245598838407,
|
||||
58203565325359399008402633568948830189458628227828,
|
||||
80181199384826282014278194139940567587151170094390,
|
||||
35398664372827112653829987240784473053190104293586,
|
||||
86515506006295864861532075273371959191420517255829,
|
||||
71693888707715466499115593487603532921714970056938,
|
||||
54370070576826684624621495650076471787294438377604,
|
||||
53282654108756828443191190634694037855217779295145,
|
||||
36123272525000296071075082563815656710885258350721,
|
||||
45876576172410976447339110607218265236877223636045,
|
||||
17423706905851860660448207621209813287860733969412,
|
||||
81142660418086830619328460811191061556940512689692,
|
||||
51934325451728388641918047049293215058642563049483,
|
||||
62467221648435076201727918039944693004732956340691,
|
||||
15732444386908125794514089057706229429197107928209,
|
||||
55037687525678773091862540744969844508330393682126,
|
||||
18336384825330154686196124348767681297534375946515,
|
||||
80386287592878490201521685554828717201219257766954,
|
||||
78182833757993103614740356856449095527097864797581,
|
||||
16726320100436897842553539920931837441497806860984,
|
||||
48403098129077791799088218795327364475675590848030,
|
||||
87086987551392711854517078544161852424320693150332,
|
||||
59959406895756536782107074926966537676326235447210,
|
||||
69793950679652694742597709739166693763042633987085,
|
||||
41052684708299085211399427365734116182760315001271,
|
||||
65378607361501080857009149939512557028198746004375,
|
||||
35829035317434717326932123578154982629742552737307,
|
||||
94953759765105305946966067683156574377167401875275,
|
||||
88902802571733229619176668713819931811048770190271,
|
||||
25267680276078003013678680992525463401061632866526,
|
||||
36270218540497705585629946580636237993140746255962,
|
||||
24074486908231174977792365466257246923322810917141,
|
||||
91430288197103288597806669760892938638285025333403,
|
||||
34413065578016127815921815005561868836468420090470,
|
||||
23053081172816430487623791969842487255036638784583,
|
||||
11487696932154902810424020138335124462181441773470,
|
||||
63783299490636259666498587618221225225512486764533,
|
||||
67720186971698544312419572409913959008952310058822,
|
||||
95548255300263520781532296796249481641953868218774,
|
||||
76085327132285723110424803456124867697064507995236,
|
||||
37774242535411291684276865538926205024910326572967,
|
||||
23701913275725675285653248258265463092207058596522,
|
||||
29798860272258331913126375147341994889534765745501,
|
||||
18495701454879288984856827726077713721403798879715,
|
||||
38298203783031473527721580348144513491373226651381,
|
||||
34829543829199918180278916522431027392251122869539,
|
||||
40957953066405232632538044100059654939159879593635,
|
||||
29746152185502371307642255121183693803580388584903,
|
||||
41698116222072977186158236678424689157993532961922,
|
||||
62467957194401269043877107275048102390895523597457,
|
||||
23189706772547915061505504953922979530901129967519,
|
||||
86188088225875314529584099251203829009407770775672,
|
||||
11306739708304724483816533873502340845647058077308,
|
||||
82959174767140363198008187129011875491310547126581,
|
||||
97623331044818386269515456334926366572897563400500,
|
||||
42846280183517070527831839425882145521227251250327,
|
||||
55121603546981200581762165212827652751691296897789,
|
||||
32238195734329339946437501907836945765883352399886,
|
||||
75506164965184775180738168837861091527357929701337,
|
||||
62177842752192623401942399639168044983993173312731,
|
||||
32924185707147349566916674687634660915035914677504,
|
||||
99518671430235219628894890102423325116913619626622,
|
||||
73267460800591547471830798392868535206946944540724,
|
||||
76841822524674417161514036427982273348055556214818,
|
||||
97142617910342598647204516893989422179826088076852,
|
||||
87783646182799346313767754307809363333018982642090,
|
||||
10848802521674670883215120185883543223812876952786,
|
||||
71329612474782464538636993009049310363619763878039,
|
||||
62184073572399794223406235393808339651327408011116,
|
||||
66627891981488087797941876876144230030984490851411,
|
||||
60661826293682836764744779239180335110989069790714,
|
||||
85786944089552990653640447425576083659976645795096,
|
||||
66024396409905389607120198219976047599490197230297,
|
||||
64913982680032973156037120041377903785566085089252,
|
||||
16730939319872750275468906903707539413042652315011,
|
||||
94809377245048795150954100921645863754710598436791,
|
||||
78639167021187492431995700641917969777599028300699,
|
||||
15368713711936614952811305876380278410754449733078,
|
||||
40789923115535562561142322423255033685442488917353,
|
||||
44889911501440648020369068063960672322193204149535,
|
||||
41503128880339536053299340368006977710650566631954,
|
||||
81234880673210146739058568557934581403627822703280,
|
||||
82616570773948327592232845941706525094512325230608,
|
||||
22918802058777319719839450180888072429661980811197,
|
||||
77158542502016545090413245809786882778948721859617,
|
||||
72107838435069186155435662884062257473692284509516,
|
||||
20849603980134001723930671666823555245252804609722,
|
||||
53503534226472524250874054075591789781264330331690
|
||||
]),
|
||||
10
|
||||
)
|
||||
);
|
24
euler/src/2 - Even Fibonacci Numbers.ts
Normal file
|
@ -0,0 +1,24 @@
|
|||
export {};
|
||||
|
||||
const calcSum = (numbers: number[]) => numbers.reduce((a, b) => a + b);
|
||||
|
||||
const fibonacciNumbers = (upperBound: number) => {
|
||||
const sequence = [1, 2];
|
||||
|
||||
// Keep making new numbers in the sequence until we hit the upper bound
|
||||
while (sequence[sequence.length - 1] < upperBound) {
|
||||
const newValue = sequence[sequence.length - 1] + sequence[sequence.length - 2];
|
||||
sequence.push(newValue);
|
||||
}
|
||||
|
||||
return sequence;
|
||||
};
|
||||
|
||||
const evenFibonacciNumbers = (upperBound: number) => {
|
||||
const sequence = fibonacciNumbers(upperBound);
|
||||
const even = sequence.filter(n => n % 2 === 0);
|
||||
|
||||
return even;
|
||||
};
|
||||
|
||||
console.log(calcSum(evenFibonacciNumbers(4000000)));
|
14
euler/src/3 - Largest Prime Factor.ts
Normal file
|
@ -0,0 +1,14 @@
|
|||
export {};
|
||||
|
||||
const largestPrimeFactor = (number: number) => {
|
||||
let i = 2;
|
||||
|
||||
while (i * i <= number) {
|
||||
if (number % i) i += 1;
|
||||
else number = Math.floor(number / i);
|
||||
}
|
||||
|
||||
return number;
|
||||
};
|
||||
|
||||
console.log(largestPrimeFactor(600851475143));
|
23
euler/src/4 - Largest Palindrome Number.ts
Normal file
|
@ -0,0 +1,23 @@
|
|||
export {};
|
||||
|
||||
const largestPallidromeNumber = (lowerBound: number, upperBound: number) => {
|
||||
// Work out all of the products of 3 digit numbers
|
||||
const products: number[] = [];
|
||||
|
||||
for (let i = lowerBound; i < upperBound + 1; i++) {
|
||||
for (let j = lowerBound; j < upperBound + 1; j++) {
|
||||
products.push(i * j);
|
||||
}
|
||||
}
|
||||
|
||||
// Filter for palindromic numbers
|
||||
const palindromic = products.filter(
|
||||
x => x.toString() === x.toString().split('').reverse().join('')
|
||||
);
|
||||
|
||||
// Find the biggest palindrome number
|
||||
const sorted = palindromic.sort((a, b) => b - a);
|
||||
return sorted[0];
|
||||
};
|
||||
|
||||
console.log(largestPallidromeNumber(100, 999));
|
21
euler/src/5 - Smallest Number.ts
Normal file
|
@ -0,0 +1,21 @@
|
|||
export {};
|
||||
|
||||
/**
|
||||
* Is x disible to n?
|
||||
*/
|
||||
const isDivisibleTo = (x: number, n: number) => {
|
||||
for (; n > 0; n -= 1) {
|
||||
if (x % n !== 0) return false;
|
||||
}
|
||||
|
||||
return true;
|
||||
};
|
||||
|
||||
const divisibleTo = (n: number) => {
|
||||
if (n === 1) return 1;
|
||||
|
||||
for (var step = divisibleTo(n - 1), i = step; !isDivisibleTo(i, n); i += step);
|
||||
return i;
|
||||
};
|
||||
|
||||
console.log(divisibleTo(20));
|
31
euler/src/6 - Sum Square Difference.ts
Normal file
|
@ -0,0 +1,31 @@
|
|||
export {};
|
||||
|
||||
const calcSum = (numbers: number[]) => numbers.reduce((a, b) => a + b);
|
||||
|
||||
const sumOfSquares = (lowerBound: number, upperBound: number) => {
|
||||
// Calculate the square number of all the numbers between the bounds
|
||||
const squares: number[] = [];
|
||||
|
||||
for (let i = lowerBound; i < upperBound + 1; i++) {
|
||||
squares.push(i ** 2);
|
||||
}
|
||||
|
||||
// Return the sum
|
||||
return calcSum(squares);
|
||||
};
|
||||
|
||||
const squareOfSum = (lowerBound: number, upperBound: number) => {
|
||||
// Get the sum of all of the numbers between the bounds
|
||||
const numbers: number[] = [];
|
||||
|
||||
for (let i = lowerBound; i < upperBound + 1; i++) {
|
||||
numbers.push(i);
|
||||
}
|
||||
|
||||
const sum = calcSum(numbers);
|
||||
|
||||
// Square the sum
|
||||
return sum ** 2;
|
||||
};
|
||||
|
||||
console.log(squareOfSum(1, 100) - sumOfSquares(1, 100));
|
23
euler/src/7 - 10001st Prime.ts
Normal file
|
@ -0,0 +1,23 @@
|
|||
export {};
|
||||
|
||||
const isPrime = (number: number) => {
|
||||
for (var i = 2; i < number; i++) {
|
||||
if (number % i === 0) return false;
|
||||
}
|
||||
|
||||
return true;
|
||||
};
|
||||
|
||||
const nthPrime = (n: number) => {
|
||||
const primes: number[] = [];
|
||||
let number = 2;
|
||||
|
||||
while (n > primes.length) {
|
||||
if (isPrime(number)) primes.push(number);
|
||||
number++;
|
||||
}
|
||||
|
||||
return primes[n - 1];
|
||||
};
|
||||
|
||||
console.log(nthPrime(10001));
|
38
euler/src/8 - Largest Product in a Series.ts
Normal file
|
@ -0,0 +1,38 @@
|
|||
export {};
|
||||
|
||||
const largestProduct = (number: bigint | number, adjacentDigits: number) => {
|
||||
let cursorIndex = 0;
|
||||
const selections: number[][] = [];
|
||||
|
||||
while (cursorIndex < number.toString().length) {
|
||||
const characters = number.toString().split('');
|
||||
|
||||
// Select the next 13 numbers
|
||||
const selection: number[] = [];
|
||||
|
||||
for (let i = 0; i < adjacentDigits; i++) {
|
||||
selection.push(parseInt(characters[cursorIndex + i]));
|
||||
}
|
||||
|
||||
if (!selection.includes(NaN)) selections.push(selection);
|
||||
|
||||
// Keep moving the cursor along
|
||||
cursorIndex++;
|
||||
}
|
||||
|
||||
// Work out the products
|
||||
const products: number[] = [];
|
||||
|
||||
for (let i = 0; i < selections.length; i++) {
|
||||
products.push(selections[i].reduce((a, b) => a * b));
|
||||
}
|
||||
|
||||
// Return the largest product
|
||||
return products.sort((a, b) => b - a)[0];
|
||||
};
|
||||
|
||||
const number = BigInt(
|
||||
'7316717653133062491922511967442657474235534919493496983520312774506326239578318016984801869478851843858615607891129494954595017379583319528532088055111254069874715852386305071569329096329522744304355766896648950445244523161731856403098711121722383113622298934233803081353362766142828064444866452387493035890729629049156044077239071381051585930796086670172427121883998797908792274921901699720888093776657273330010533678812202354218097512545405947522435258490771167055601360483958644670632441572215539753697817977846174064955149290862569321978468622482839722413756570560574902614079729686524145351004748216637048440319989000889524345065854122758866688116427171479924442928230863465674813919123162824586178664583591245665294765456828489128831426076900422421902267105562632111110937054421750694165896040807198403850962455444362981230987879927244284909188845801561660979191338754992005240636899125607176060588611646710940507754100225698315520005593572972571636269561882670428252483600823257530420752963450'
|
||||
);
|
||||
|
||||
console.log(largestProduct(number, 13));
|
38
euler/src/9 - Special Pythagorean Triplet.ts
Normal file
|
@ -0,0 +1,38 @@
|
|||
export {};
|
||||
|
||||
// a + b + c = 1000
|
||||
// we need a * b * c
|
||||
// pythagorean triplet: a < b < c
|
||||
// a^2 + b^2 = c^2
|
||||
|
||||
const pythagoreanTriplet = (sum: number) => {
|
||||
let a: number,
|
||||
b = 1,
|
||||
c: number;
|
||||
|
||||
for (; b < sum; b++) {
|
||||
// let x = sum
|
||||
|
||||
// c = x - (a + b)
|
||||
// a^2 + b^2 = (x - (a + b))^2
|
||||
// a^2 + b^2 = a^2 + 2ab - 2ax + b^2 - 2bx + x^2
|
||||
// 0 = 2ab - 2ax - 2bx + x^2
|
||||
|
||||
// 2bx - 2ab = x^2 - 2ax
|
||||
// (x^2 / x) - 2a = 2b - (2ab / x)
|
||||
// -2a = 2b - (2ab / x) - (x^2 / x)
|
||||
// a = - (((x * 2b) - (x * x)) / ((2 * x) - (2 * b)))
|
||||
a = -((sum * (2 * b) - sum * sum) / (2 * sum - 2 * b));
|
||||
|
||||
if (Math.floor(a) === a) {
|
||||
c = sum - a - b;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
return { a, b, c };
|
||||
};
|
||||
|
||||
const triplet = pythagoreanTriplet(1000);
|
||||
console.log(triplet);
|
||||
console.log(triplet.a * triplet.b * triplet.c);
|
10
euler/tsconfig.json
Normal file
|
@ -0,0 +1,10 @@
|
|||
{
|
||||
"compilerOptions": {
|
||||
"target": "es5",
|
||||
"module": "commonjs",
|
||||
"outDir": "build",
|
||||
"downlevelIteration": true
|
||||
},
|
||||
"include": ["src/**/*.ts"],
|
||||
"exclude": ["node_modules"]
|
||||
}
|
47
java/calculators/ncr.java
Normal file
|
@ -0,0 +1,47 @@
|
|||
package calculators;
|
||||
import java.util.InputMismatchException;
|
||||
import java.util.Scanner;
|
||||
|
||||
class CombinationCalculator {
|
||||
private static Scanner scanner = new Scanner(System.in);
|
||||
|
||||
private static int factorial(int n) {
|
||||
int res = 1;
|
||||
|
||||
for (int i = 2; i <= n; i++) {
|
||||
res *= i;
|
||||
}
|
||||
|
||||
return res;
|
||||
}
|
||||
|
||||
private static int nCr(int n, int r) {
|
||||
return factorial(n) / (factorial(r) * factorial(n - r));
|
||||
}
|
||||
|
||||
private static int intInput(String message) {
|
||||
int value = -1;
|
||||
|
||||
while (value < 0) {
|
||||
try {
|
||||
System.out.print(message);
|
||||
value = scanner.nextInt();
|
||||
} catch (InputMismatchException e) {
|
||||
scanner.next();
|
||||
}
|
||||
}
|
||||
|
||||
return value;
|
||||
}
|
||||
|
||||
public static void main(String[] args) {
|
||||
// Take inputs
|
||||
int n = intInput("Please input the value for n: ");
|
||||
int r = intInput("Please input the value for r: ");
|
||||
scanner.close();
|
||||
|
||||
// Calculate the result
|
||||
int result = nCr(n, r);
|
||||
System.out.println(result);
|
||||
}
|
||||
}
|
14
package.json
|
@ -1,14 +0,0 @@
|
|||
{
|
||||
"name": "the-honk",
|
||||
"scripts": {
|
||||
"prepare": "husky install"
|
||||
},
|
||||
"devDependencies": {
|
||||
"@types/node": "^17.0.6",
|
||||
"commitizen": "^4.2.4",
|
||||
"cz-conventional-changelog": "^3.3.0",
|
||||
"husky": "^7.0.4",
|
||||
"prettier": "^2.5.1",
|
||||
"pretty-quick": "^3.1.3"
|
||||
}
|
||||
}
|
1659
pnpm-lock.yaml
|
@ -1,50 +0,0 @@
|
|||
# (a + b) ^ n
|
||||
superscript = ['⁰', '¹', '²', '³', '⁴', '⁵', '⁶', '⁷', '⁸', '⁹']
|
||||
|
||||
def factorial(n):
|
||||
ans = 1
|
||||
for i in range(2, n + 1):
|
||||
ans *= i
|
||||
return ans
|
||||
|
||||
def nCr(n, r):
|
||||
return factorial(n) / (factorial(r) * factorial(n - r))
|
||||
|
||||
while True:
|
||||
try:
|
||||
n = int(input('Please enter a power to put (a + b) to! '))
|
||||
break
|
||||
except ValueError:
|
||||
print('The power must be a valid integer!')
|
||||
continue
|
||||
|
||||
terms = []
|
||||
|
||||
for r in range(n + 1):
|
||||
a = n - r
|
||||
b = r
|
||||
c = int(nCr(n, r))
|
||||
term = ''
|
||||
|
||||
if c != 1:
|
||||
term += str(c)
|
||||
|
||||
if a != 0:
|
||||
term += 'a'
|
||||
if a != 1:
|
||||
power = ''
|
||||
for digit in str(a):
|
||||
power += superscript[int(digit)]
|
||||
term += power
|
||||
|
||||
if b != 0:
|
||||
term += 'b'
|
||||
if b != 1:
|
||||
power = ''
|
||||
for digit in str(b):
|
||||
power += superscript[int(digit)]
|
||||
term += power
|
||||
|
||||
terms.append(term)
|
||||
|
||||
print(' + '.join(terms))
|
28
python/calculators/Karatsuba Algorithm.md
Normal file
|
@ -0,0 +1,28 @@
|
|||
### Useful Links
|
||||
|
||||
- [Wikipedia](https://en.wikipedia.org/wiki/Karatsuba_algorithm)
|
||||
- [An amazing video on the topic](https://youtu.be/cCKOl5li6YM)
|
||||
|
||||
### The Pseudocode
|
||||
|
||||
```
|
||||
function karatsuba (num1, num2)
|
||||
if (num1 < 10) or (num2 < 10)
|
||||
return num1 × num2 /* fall back to traditional multiplication */
|
||||
|
||||
/* Calculates the size of the numbers. */
|
||||
m = min (size_base10(num1), size_base10(num2))
|
||||
m2 = floor (m / 2)
|
||||
/* m2 = ceil (m / 2) will also work */
|
||||
|
||||
/* Split the digit sequences in the middle. */
|
||||
high1, low1 = split_at (num1, m2)
|
||||
high2, low2 = split_at (num2, m2)
|
||||
|
||||
/* 3 recursive calls made to numbers approximately half the size. */
|
||||
z0 = karatsuba (low1, low2)
|
||||
z1 = karatsuba (low1 + high1, low2 + high2)
|
||||
z2 = karatsuba (high1, high2)
|
||||
|
||||
return (z2 × 10 ^ (m2 × 2)) + ((z1 - z2 - z0) × 10 ^ m2) + z0
|
||||
```
|
|
@ -1,87 +0,0 @@
|
|||
from string import ascii_lowercase as alphabet
|
||||
from itertools import permutations
|
||||
|
||||
superscript = ['⁰', '¹', '²', '³', '⁴', '⁵', '⁶', '⁷', '⁸', '⁹']
|
||||
|
||||
def factorial(n):
|
||||
ans = 1
|
||||
for i in range(2, n + 1):
|
||||
ans *= i
|
||||
return ans
|
||||
|
||||
def multinomialCoefficient(n, *k):
|
||||
ans = factorial(n)
|
||||
|
||||
for i in k:
|
||||
ans //= factorial(i)
|
||||
|
||||
return ans
|
||||
|
||||
while True:
|
||||
try:
|
||||
m = int(input('Please enter an amount of nomials to include (: '))
|
||||
|
||||
if m > len(alphabet):
|
||||
raise ValueError
|
||||
|
||||
selectedLetters = alphabet[:m]
|
||||
break
|
||||
except ValueError:
|
||||
print('Please ensure that you choose a valid amount of nomials (less than or equal to 26 please [:)')
|
||||
continue
|
||||
|
||||
while True:
|
||||
try:
|
||||
n = int(input('Please enter a power to put (%s) to! ' % ' + '.join(selectedLetters)))
|
||||
break
|
||||
except ValueError:
|
||||
print('The power must be a valid integer!')
|
||||
continue
|
||||
|
||||
# [{ letter: power }]
|
||||
nomials = []
|
||||
currentPower = {}
|
||||
|
||||
# Filter the power combinations for only where they add up to n
|
||||
powerCombinations = list(set(permutations([i for i in range(0, n + 1)] * m, m)))
|
||||
|
||||
for combo in powerCombinations:
|
||||
if sum(combo) != n:
|
||||
continue
|
||||
|
||||
powers = {}
|
||||
|
||||
for i in range(len(combo)):
|
||||
letter = selectedLetters[i]
|
||||
powers[letter] = combo[i]
|
||||
|
||||
nomials.append(powers)
|
||||
|
||||
formattedTerms = []
|
||||
|
||||
for nomial in nomials:
|
||||
coefficient = multinomialCoefficient(n, *nomial.values())
|
||||
term = ''
|
||||
|
||||
if coefficient == 0:
|
||||
continue
|
||||
elif coefficient != 1:
|
||||
term += str(coefficient)
|
||||
|
||||
for letter in nomial:
|
||||
power = nomial[letter]
|
||||
|
||||
if power == 1:
|
||||
term += letter
|
||||
elif power > 0:
|
||||
powerString = ''
|
||||
|
||||
for digit in str(power):
|
||||
powerString += superscript[int(digit)]
|
||||
|
||||
term += '%s%s' % (letter, powerString)
|
||||
|
||||
formattedTerms.append(term)
|
||||
|
||||
print(' + '.join(formattedTerms))
|
||||
|
27
python/calculators/Quadratic nth Term.py
Normal file
|
@ -0,0 +1,27 @@
|
|||
import operator
|
||||
from _helpers import listInput
|
||||
|
||||
def diff(a):
|
||||
return list(map(operator.sub, a[1:], a[:-1]))
|
||||
|
||||
def formatNumber(x):
|
||||
if x % 1 == 0:
|
||||
return int(x)
|
||||
else:
|
||||
return x
|
||||
|
||||
sequence = listInput('Please input a sequence of numbers')
|
||||
row1 = diff(sequence)
|
||||
row2 = diff(row1)
|
||||
|
||||
a = formatNumber(row2[0] / 2)
|
||||
b = formatNumber(row1[0] - (3 * a))
|
||||
c = formatNumber(sequence[0] - a - b)
|
||||
|
||||
print('''
|
||||
a = {0}
|
||||
b = {2}
|
||||
c = {4}
|
||||
|
||||
Equation: {0}n²{1}{2}n{3}{4}
|
||||
'''.format(a, '+' if b >= 0 else '', b, '+' if c >= 0 else '', c))
|
|
@ -5,11 +5,11 @@ Created as a part of my Royal Institute masterclass
|
|||
|
||||
from _helpers import intInput
|
||||
|
||||
def sqrt(number):
|
||||
initialGuess = 2
|
||||
while abs(initialGuess - (number / initialGuess)) > 1:
|
||||
initialGuess = (initialGuess + (number / initialGuess)) / 2
|
||||
return int(initialGuess)
|
||||
def sqrt(x):
|
||||
a = 2
|
||||
while abs((a - (x / a))) > 1:
|
||||
a = (a + (x / a)) / 2
|
||||
return int(a)
|
||||
|
||||
num = intInput('Please input a number! (:')
|
||||
res = sqrt(num)
|
16
python/calculators/STDEV.py
Normal file
|
@ -0,0 +1,16 @@
|
|||
import math
|
||||
from _helpers import listInput
|
||||
|
||||
def sd(x):
|
||||
n = len(x)
|
||||
mean = sum(x) / n
|
||||
squared = [y ** 2 for y in x]
|
||||
|
||||
return math.sqrt(abs((sum(squared) / n) - (mean**2)))
|
||||
|
||||
nums = listInput('Please input a list of numbers')
|
||||
res = sd(nums)
|
||||
|
||||
print()
|
||||
print('The list:', nums)
|
||||
print('Standard Deviation:', res)
|
|
@ -1,56 +1,22 @@
|
|||
from cmath import e, pi, sqrt, log
|
||||
from math import e
|
||||
from _helpers import floatInput
|
||||
|
||||
i = sqrt(-1)
|
||||
def sin(radians):
|
||||
x = radians
|
||||
return (((e ** (1j * x)) - (e ** -(1j * x))) / 2j).real
|
||||
|
||||
compute = lambda numerator, denominator: (numerator / denominator).real
|
||||
computeInverse = lambda x: (-i * log(x, e)).real
|
||||
def cos(radians):
|
||||
x = radians
|
||||
return (((e ** (1j * x)) + (e ** -(1j * x))) / 2).real
|
||||
|
||||
sin = lambda x: compute(pow(e, i * x) - pow(e, -i * x), 2 * i)
|
||||
cos = lambda x: compute(pow(e, i * x) + pow(e, -i * x), 2)
|
||||
tan = lambda x: compute(pow(e, i * x) - pow(e, -i * x), i * (pow(e, i * x) + pow(e, -i * x)))
|
||||
csc = lambda x: 1 / sin(x)
|
||||
sec = lambda x: 1 / cos(x)
|
||||
cot = lambda x: 1 / tan(x)
|
||||
def tan(radians):
|
||||
x = radians
|
||||
return (((e ** (1j * x)) - (e ** -(1j * x))) / (1j * ((e ** (1j * x)) + (e ** -(1j * x))))).real
|
||||
|
||||
arcsin = lambda x: computeInverse((i * x) + sqrt(1 - pow(x, 2)))
|
||||
arccos = lambda x: computeInverse(x + sqrt(pow(x, 2) - 1))
|
||||
arctan = lambda x: computeInverse((i - x) / (i + x)) / 2
|
||||
arccsc = lambda x: computeInverse((pow(x, -1) * i) + sqrt(1 - pow(x, -2)))
|
||||
arcsec = lambda x: computeInverse((pow(x, -1)) + sqrt(pow(x, -2) - 1))
|
||||
arccot = lambda x: computeInverse((x + i) / (x - i)) / 2
|
||||
a = floatInput("Please enter an amount of radians: ")
|
||||
|
||||
# todo: hyperbolic functions
|
||||
|
||||
# todo: hyperbolic inverse functions
|
||||
|
||||
# todo: hyperbolic reciprocal functions
|
||||
|
||||
# todo: hyperbolic inverse reciprocal functions
|
||||
|
||||
radians = floatInput("Please enter an amount of radians: ")
|
||||
|
||||
print(f"""
|
||||
Trigometric functions
|
||||
|
||||
sin({radians}) = {sin(radians)}
|
||||
cos({radians}) = {cos(radians)}
|
||||
tan({radians}) = {tan(radians)}
|
||||
|
||||
Reciprocal trigometric functions
|
||||
|
||||
csc({radians}) = {csc(radians)}
|
||||
sec({radians}) = {sec(radians)}
|
||||
cot({radians}) = {cot(radians)}
|
||||
|
||||
Inverse trigometric functions
|
||||
|
||||
arcsin({sin(radians)}) = {arcsin(sin(radians))}
|
||||
arccos({cos(radians)}) = {arccos(cos(radians))}
|
||||
arctan({tan(radians)}) = {arctan(tan(radians))}
|
||||
|
||||
Inverse reciprocal trigometric functions
|
||||
|
||||
arccsc({csc(radians)}) = {arccsc(csc(radians))}
|
||||
arcsec({sec(radians)}) = {arcsec(sec(radians))}
|
||||
arccot({cot(radians)}) = {arccot(cot(radians))}""")
|
||||
print("""Where x = %i:
|
||||
sin(x) = %f
|
||||
cos(x) = %f
|
||||
tan(x) = %f
|
||||
""" % (a, sin(a), cos(a), tan(a)))
|
||||
|
|
|
@ -2,7 +2,7 @@
|
|||
def floatInput(text):
|
||||
while True:
|
||||
try:
|
||||
x = float(input(text))
|
||||
x = float(input(text + '\n'))
|
||||
return x
|
||||
except ValueError:
|
||||
print('You must input a float!\n')
|
||||
print('You must input a float integer!\n')
|
||||
|
|
|
@ -2,7 +2,7 @@
|
|||
def intInput(text):
|
||||
while True:
|
||||
try:
|
||||
x = int(input(text))
|
||||
x = int(input(text + '\n'))
|
||||
return x
|
||||
except ValueError:
|
||||
print('You must input an integer!\n')
|
||||
|
|
|
@ -1,63 +0,0 @@
|
|||
from typing import Union
|
||||
from _helpers import floatInput, intInput
|
||||
from dataclasses import dataclass
|
||||
|
||||
@dataclass
|
||||
class Result:
|
||||
result: Union[float, int]
|
||||
maxIterations: int
|
||||
iterationsUsed: int
|
||||
|
||||
superscript = [ '⁰', '¹', '²', '³', '⁴', '⁵', '⁶', '⁷', '⁸', '⁹' ]
|
||||
|
||||
def formatRadical(n: float, x: float):
|
||||
formattedN, formattedX = '', ''
|
||||
|
||||
if int(n) == n:
|
||||
nString = str(int(n))
|
||||
|
||||
for i in range(len(nString)):
|
||||
digit = int(nString[i])
|
||||
formattedN += superscript[digit]
|
||||
|
||||
else:
|
||||
nString = str(n)
|
||||
|
||||
for i in range(len(nString)):
|
||||
try:
|
||||
digit = int(nString[i])
|
||||
formattedN += superscript[digit]
|
||||
except:
|
||||
formattedN += '˙'
|
||||
|
||||
if int(x) == x:
|
||||
formattedX = str(int(x))
|
||||
else:
|
||||
formattedX = str(x)
|
||||
|
||||
return f"{formattedN}√{formattedX}"
|
||||
|
||||
def nthRoot(n: float, x: float, maxIterations: int = 200) -> Result:
|
||||
lastIteration, iteration, iterationsUsed = 0, 1, 0
|
||||
|
||||
for _ in range(maxIterations):
|
||||
if lastIteration == iteration:
|
||||
break
|
||||
|
||||
iterationsUsed += 1
|
||||
lastIteration = iteration
|
||||
iteration = ((iteration * (n - 1)) + (x * (iteration ** (1 - n)))) / n
|
||||
|
||||
if int(iteration) == iteration:
|
||||
iteration = int(iteration)
|
||||
|
||||
return Result(iteration, maxIterations, iterationsUsed)
|
||||
|
||||
print('ⁿ√x')
|
||||
n = floatInput('Please input a value for n: ')
|
||||
x = floatInput('Please input a value for x: ')
|
||||
iterations = intInput('Please enter an amount of iterations to perform: ')
|
||||
root = nthRoot(n, x, iterations)
|
||||
|
||||
print(f'\n{formatRadical(n, x)} = {root.result}')
|
||||
print(f'Used {root.iterationsUsed} out of {root.maxIterations} iterations (:')
|
|
@ -1,12 +0,0 @@
|
|||
import math
|
||||
|
||||
pi = 0
|
||||
|
||||
for k in range(20):
|
||||
numerator = (2 ** k) * (math.factorial(k) ** 2)
|
||||
denominator = math.factorial((2 * k) + 1)
|
||||
|
||||
pi += numerator / denominator
|
||||
|
||||
pi *= 2
|
||||
print(pi)
|
34
python/calculators/readme.md
Normal file
|
@ -0,0 +1,34 @@
|
|||
# calculators
|
||||
|
||||
Some extra information on the more complex topics (:
|
||||
|
||||
## Karatsuba Algorithm
|
||||
|
||||
### Useful Links
|
||||
|
||||
- [Wikipedia](https://en.wikipedia.org/wiki/Karatsuba_algorithm)
|
||||
- [An amazing video on the topic](https://youtu.be/cCKOl5li6YM)
|
||||
|
||||
### The Pseudocode
|
||||
|
||||
```
|
||||
function karatsuba (num1, num2)
|
||||
if (num1 < 10) or (num2 < 10)
|
||||
return num1 × num2 /* fall back to traditional multiplication */
|
||||
|
||||
/* Calculates the size of the numbers. */
|
||||
m = min (size_base10(num1), size_base10(num2))
|
||||
m2 = floor (m / 2)
|
||||
/* m2 = ceil (m / 2) will also work */
|
||||
|
||||
/* Split the digit sequences in the middle. */
|
||||
high1, low1 = split_at (num1, m2)
|
||||
high2, low2 = split_at (num2, m2)
|
||||
|
||||
/* 3 recursive calls made to numbers approximately half the size. */
|
||||
z0 = karatsuba (low1, low2)
|
||||
z1 = karatsuba (low1 + high1, low2 + high2)
|
||||
z2 = karatsuba (high1, high2)
|
||||
|
||||
return (z2 × 10 ^ (m2 × 2)) + ((z1 - z2 - z0) × 10 ^ m2) + z0
|
||||
```
|
|
@ -1,11 +0,0 @@
|
|||
def chunkArray(array, chunkCount):
|
||||
chunks = []
|
||||
|
||||
for i in reversed(range(1, chunkCount + 1)):
|
||||
splitPoint = len(array) // i
|
||||
chunks.append(array[:splitPoint])
|
||||
array = array[splitPoint:]
|
||||
|
||||
return chunks
|
||||
|
||||
print(chunkArray([1,2,3,4,5,6], 4))
|
21
python/data-science/facebook.csv
Normal file
|
@ -0,0 +1,21 @@
|
|||
,country,active,population,percentActive
|
||||
0,India,340000000,1295210000,26.250569405733433
|
||||
1,United States,200000000,323947000,61.738494259863494
|
||||
2,Indonesia,140000000,258705000,54.11569161786591
|
||||
3,Brazil,130000000,206135893,63.065193600223715
|
||||
4,Mexico,98000000,122273473,80.14821007006155
|
||||
5,Philippines,88000000,103279800,85.20543223360231
|
||||
6,Vietnam,71000000,92700000,76.59115426105717
|
||||
7,Thailand,54000000,65327652,82.6602492922905
|
||||
8,Egypt,47000000,91290000,51.484280863183265
|
||||
9,Bangladesh,46000000,161006790,28.570223653300587
|
||||
10,Pakistan,45000000,194125062,23.18093271233572
|
||||
11,Colombia,38000000,48759958,77.93279887566761
|
||||
12,United Kingdom,38000000,65110000,58.36277069574566
|
||||
13,Turkey,37000000,78741053,46.98946558410896
|
||||
14,France,33000000,66710000,49.46784590016489
|
||||
15,Argentina,31000000,43590400,71.11657612685362
|
||||
16,Italy,31000000,60665551,51.099840830589336
|
||||
17,Nigeria,31000000,186988000,16.578603974586603
|
||||
18,Germany,28000000,81770900,34.24201029950753
|
||||
19,Peru,27000000,31488700,85.74504504790607
|
|
101
python/data-science/fakejobs.csv
Normal file
|
@ -0,0 +1,101 @@
|
|||
,title,company,location
|
||||
0,Senior Python Developer,"Payne, Roberts and Davis","Stewartbury, AA"
|
||||
1,Energy engineer,Vasquez-Davidson,"Christopherville, AA"
|
||||
2,Legal executive,"Jackson, Chambers and Levy","Port Ericaburgh, AA"
|
||||
3,Fitness centre manager,Savage-Bradley,"East Seanview, AP"
|
||||
4,Product manager,Ramirez Inc,"North Jamieview, AP"
|
||||
5,Medical technical officer,Rogers-Yates,"Davidville, AP"
|
||||
6,Physiological scientist,Kramer-Klein,"South Christopher, AE"
|
||||
7,Textile designer,Meyers-Johnson,"Port Jonathan, AE"
|
||||
8,Television floor manager,Hughes-Williams,"Osbornetown, AE"
|
||||
9,Waste management officer,"Jones, Williams and Villa","Scotttown, AP"
|
||||
10,Software Engineer (Python),Garcia PLC,"Ericberg, AE"
|
||||
11,Interpreter,Gregory and Sons,"Ramireztown, AE"
|
||||
12,Architect,"Clark, Garcia and Sosa","Figueroaview, AA"
|
||||
13,Meteorologist,Bush PLC,"Kelseystad, AA"
|
||||
14,Audiological scientist,Salazar-Meyers,"Williamsburgh, AE"
|
||||
15,English as a second language teacher,"Parker, Murphy and Brooks","Mitchellburgh, AE"
|
||||
16,Surgeon,Cruz-Brown,"West Jessicabury, AA"
|
||||
17,Equities trader,Macdonald-Ferguson,"Maloneshire, AE"
|
||||
18,Newspaper journalist,"Williams, Peterson and Rojas","Johnsonton, AA"
|
||||
19,Materials engineer,Smith and Sons,"South Davidtown, AP"
|
||||
20,Python Programmer (Entry-Level),"Moss, Duncan and Allen","Port Sara, AE"
|
||||
21,Product/process development scientist,Gomez-Carroll,"Marktown, AA"
|
||||
22,"Scientist, research (maths)","Manning, Welch and Herring","Laurenland, AE"
|
||||
23,Ecologist,"Lee, Gutierrez and Brown","Lauraton, AP"
|
||||
24,Materials engineer,"Davis, Serrano and Cook","South Tammyberg, AP"
|
||||
25,Historic buildings inspector/conservation officer,Smith LLC,"North Brandonville, AP"
|
||||
26,Data scientist,Thomas Group,"Port Robertfurt, AA"
|
||||
27,Psychiatrist,Silva-King,"Burnettbury, AE"
|
||||
28,Structural engineer,Pierce-Long,"Herbertside, AA"
|
||||
29,Immigration officer,Walker-Simpson,"Christopherport, AP"
|
||||
30,Python Programmer (Entry-Level),Cooper and Sons,"West Victor, AE"
|
||||
31,Neurosurgeon,"Donovan, Gonzalez and Figueroa","Port Aaron, AP"
|
||||
32,Broadcast engineer,"Morgan, Butler and Bennett","Loribury, AA"
|
||||
33,Make,Snyder-Lee,"Angelastad, AP"
|
||||
34,"Nurse, adult",Harris PLC,"Larrytown, AE"
|
||||
35,Air broker,Washington PLC,"West Colin, AP"
|
||||
36,"Editor, film/video","Brown, Price and Campbell","West Stephanie, AP"
|
||||
37,"Production assistant, radio",Mcgee PLC,"Laurentown, AP"
|
||||
38,"Engineer, communications",Dixon Inc,"Wrightberg, AP"
|
||||
39,Sales executive,"Thompson, Sheppard and Ward","Alberttown, AE"
|
||||
40,Software Developer (Python),Adams-Brewer,"Brockburgh, AE"
|
||||
41,Futures trader,Schneider-Brady,"North Jason, AE"
|
||||
42,Tour manager,Gonzales-Frank,"Arnoldhaven, AE"
|
||||
43,Cytogeneticist,Smith-Wong,"Lake Destiny, AP"
|
||||
44,"Designer, multimedia",Pierce-Herrera,"South Timothyburgh, AP"
|
||||
45,Trade union research officer,"Aguilar, Rivera and Quinn","New Jimmyton, AE"
|
||||
46,"Chemist, analytical","Lowe, Barnes and Thomas","New Lucasbury, AP"
|
||||
47,"Programmer, multimedia","Lewis, Gonzalez and Vasquez","Port Cory, AE"
|
||||
48,"Engineer, broadcasting (operations)",Taylor PLC,"Gileston, AA"
|
||||
49,"Teacher, primary school","Oliver, Jones and Ramirez","Cindyshire, AA"
|
||||
50,Python Developer,Rivera and Sons,"East Michaelfort, AA"
|
||||
51,Manufacturing systems engineer,Garcia PLC,"Joybury, AE"
|
||||
52,"Producer, television/film/video","Johnson, Wells and Kramer","Emmatown, AE"
|
||||
53,"Scientist, forensic",Gonzalez LLC,"Colehaven, AP"
|
||||
54,Bonds trader,"Morgan, White and Macdonald","Port Coryton, AE"
|
||||
55,Editorial assistant,Robinson-Fitzpatrick,"Amyborough, AA"
|
||||
56,Photographer,"Waters, Wilson and Hoover","Reynoldsville, AA"
|
||||
57,Retail banker,Hill LLC,"Port Billy, AP"
|
||||
58,Jewellery designer,Li-Gregory,"Adamburgh, AA"
|
||||
59,Ophthalmologist,"Fisher, Ryan and Coleman","Wilsonmouth, AA"
|
||||
60,"Back-End Web Developer (Python, Django)",Stewart-Alexander,"South Kimberly, AA"
|
||||
61,Licensed conveyancer,Abbott and Sons,"Benjaminland, AP"
|
||||
62,Futures trader,"Bryant, Santana and Davenport","Zacharyport, AA"
|
||||
63,Counselling psychologist,Smith PLC,"Port Devonville, AE"
|
||||
64,Insurance underwriter,Patterson-Singh,"East Thomas, AE"
|
||||
65,"Engineer, automotive",Martinez-Berry,"New Jeffrey, AP"
|
||||
66,"Producer, radio","May, Taylor and Fisher","Davidside, AA"
|
||||
67,Dispensing optician,"Bailey, Owen and Thompson","Jamesville, AA"
|
||||
68,"Designer, fashion/clothing",Vasquez Ltd,"New Kelly, AP"
|
||||
69,Chartered loss adjuster,Leblanc LLC,"Lake Antonio, AA"
|
||||
70,"Back-End Web Developer (Python, Django)","Jackson, Ali and Mckee","New Elizabethside, AA"
|
||||
71,Forest/woodland manager,"Blankenship, Knight and Powell","Millsbury, AE"
|
||||
72,Clinical cytogeneticist,"Patton, Haynes and Jones","Lloydton, AP"
|
||||
73,Print production planner,Wood Inc,"Port Jeremy, AA"
|
||||
74,Systems developer,Collins Group,"New Elizabethtown, AA"
|
||||
75,Graphic designer,Flores-Nelson,"Charlesstad, AE"
|
||||
76,Writer,"Mitchell, Jones and Olson","Josephbury, AE"
|
||||
77,Field seismologist,Howard Group,"Seanfurt, AA"
|
||||
78,Chief Strategy Officer,Kramer-Edwards,"Williambury, AA"
|
||||
79,Air cabin crew,Berry-Houston,"South Jorgeside, AP"
|
||||
80,Python Programmer (Entry-Level),Mathews Inc,"Robertborough, AP"
|
||||
81,Warden/ranger,Riley-Johnson,"South Saratown, AP"
|
||||
82,Sports therapist,Spencer and Sons,"Hullview, AA"
|
||||
83,Arts development officer,Camacho-Sanchez,"Philipland, AP"
|
||||
84,Printmaker,Oliver and Sons,"North Patty, AE"
|
||||
85,Health and safety adviser,Eaton PLC,"North Stephen, AE"
|
||||
86,Manufacturing systems engineer,Stanley-Frederick,"Stevensland, AP"
|
||||
87,"Programmer, applications",Bradley LLC,"Reyesstad, AE"
|
||||
88,Medical physicist,"Parker, Goodwin and Zavala","Bellberg, AP"
|
||||
89,Media planner,Kim-Miles,"North Johnland, AE"
|
||||
90,Software Developer (Python),Moreno-Rodriguez,"Martinezburgh, AE"
|
||||
91,"Surveyor, land/geomatics",Brown-Ortiz,"Joshuatown, AE"
|
||||
92,Legal executive,Hartman PLC,"West Ericstad, AA"
|
||||
93,"Librarian, academic",Brooks Inc,"Tuckertown, AE"
|
||||
94,Barrister,Washington-Castillo,"Perezton, AE"
|
||||
95,Museum/gallery exhibitions officer,"Nguyen, Yoder and Petty","Lake Abigail, AE"
|
||||
96,"Radiographer, diagnostic",Holder LLC,"Jacobshire, AP"
|
||||
97,Database administrator,Yates-Ferguson,"Port Susan, AE"
|
||||
98,Furniture designer,Ortega-Lawrence,"North Tiffany, AA"
|
||||
99,Ship broker,"Fuentes, Walls and Castro","Michelleville, AP"
|
|
|
@ -0,0 +1,6 @@
|
|||
,word,stdev,mean,median,mode,range,q1,q3,iqr
|
||||
0,dubious,8.074856963177907e-07,2.542098164301882e-06,2.5695727734793242e-06,4.196504846731841e-06,3.0245116704463726e-06,1.7397420484550302e-06,3.226037254730077e-06,1.4862952062750469e-06
|
||||
1,orangutan,5.6744864045068366e-08,3.709309897005132e-08,4.059187335465302e-09,0.0,2.0444374675727367e-07,1.531135297914789e-09,5.4957968334942316e-08,5.3426833037027525e-08
|
||||
2,round,3.7075802680862356e-05,9.990977901072485e-05,9.360353422899996e-05,0.00014768174514756538,0.00010513432425796054,6.460826716647716e-05,0.0001398687179192036,7.526045075272644e-05
|
||||
3,mockingjay,1.1911438316609437e-09,2.859439078539958e-10,0.0,0.0,6.579021454606553e-09,0.0,0.0,0.0
|
||||
4,aloof,6.530476796203353e-07,2.167393662317789e-06,1.9966990976172383e-06,1.9491102136726113e-06,2.2848745564780463e-06,1.7225131533190767e-06,2.6828633557280616e-06,9.60350202408985e-07
|
|
Before Width: | Height: | Size: 29 KiB After Width: | Height: | Size: 36 KiB |
|
@ -0,0 +1,3 @@
|
|||
,word,stdev,mean,median,mode,range,q1,q3,iqr
|
||||
0,hallo,9.067572402803685e-07,3.7112208955684736e-07,4.9074362859106e-08,0.0,5.638338344786982e-06,0.0,1.517606246384925e-07,1.517606246384925e-07
|
||||
1,hello,1.2565752685195384e-07,1.061839190423912e-07,9.166146648047808e-08,0.0,6.695058151048475e-07,0.0,1.4409192620031979e-07,1.4409192620031979e-07
|
|
Before Width: | Height: | Size: 28 KiB After Width: | Height: | Size: 32 KiB |
|
@ -0,0 +1,6 @@
|
|||
,word,stdev,mean,median,mode,range,q1,q3,iqr
|
||||
0,metropolis,6.073817672768758e-06,7.041652849609334e-06,3.609500173037564e-06,1.642420852476789e-05,1.6955333243069098e-05,1.928710913391894e-06,1.4107718048502907e-05,1.2179007135111014e-05
|
||||
1,birthday,3.405409725020581e-06,4.93635729905203e-06,4.5630913194015325e-06,1.55403999713144e-06,1.4859627640362307e-05,2.301730376075284e-06,6.613718677986721e-06,4.311988301911437e-06
|
||||
2,acidic,1.6654465043640538e-06,1.3954760914678144e-06,4.975661259517698e-07,2.545503958411339e-09,5.43006051443148e-06,1.0417356749051595e-08,3.052730814293422e-06,3.0423134575443704e-06
|
||||
3,bell,4.782058488531253e-06,1.399854644241753e-05,1.3900812583805028e-05,1.338126594419009e-05,1.488321056188267e-05,1.0143385549911598e-05,1.8471108173149074e-05,8.327722623237476e-06
|
||||
4,weed,1.0333904520821366e-06,5.493248520879915e-06,5.3136455855045436e-06,4.667169719141384e-06,4.562449346069894e-06,4.725501274346503e-06,6.275106622004906e-06,1.5496053476584033e-06
|
|
Before Width: | Height: | Size: 42 KiB After Width: | Height: | Size: 56 KiB |
|
@ -0,0 +1,3 @@
|
|||
,word,stdev,mean,median,mode,range,q1,q3,iqr
|
||||
0,poop,2.599393484092581e-07,6.139207233218996e-07,6.637646704023479e-07,9.126888329547e-07,1.069131408420227e-06,4.1074716961020385e-07,8.147061285918815e-07,4.039589589816777e-07
|
||||
1,klutzy,7.003951820605788e-09,3.2869637653755984e-09,0.0,0.0,2.649079254370333e-08,0.0,1.0566731666248965e-10,1.0566731666248965e-10
|
|
Before Width: | Height: | Size: 27 KiB After Width: | Height: | Size: 32 KiB |
|
@ -0,0 +1,7 @@
|
|||
,word,stdev,mean,median,mode,range,q1,q3,iqr
|
||||
0,shuffle,2.8673060629074946e-07,5.429429098575131e-07,4.4282361955083616e-07,3.7689945031615935e-07,1.3133971262526584e-06,3.9387709957087023e-07,5.137637860538494e-07,1.1988668648297913e-07
|
||||
1,metal,2.0682785887437696e-05,5.254399138449388e-05,4.836078629263543e-05,2.5583417482266668e-05,6.797832975280471e-05,3.6084721484387827e-05,7.032199755485635e-05,3.4237276070468526e-05
|
||||
2,cancer,1.7022368592568055e-05,1.5733501132405006e-05,9.378232204783543e-06,1.3189397805035696e-06,5.6970578595740206e-05,4.049281374461446e-06,1.7681010311727213e-05,1.3631728937265768e-05
|
||||
3,tumour,2.1500591548720935e-06,4.625488593566766e-06,4.095890549901274e-06,2.4707894965558808e-06,7.625295730966693e-06,3.083135701282507e-06,6.133632479889327e-06,3.0504967786068197e-06
|
||||
4,milk,2.7191419514085662e-05,5.2395630572415005e-05,4.103317821448269e-05,3.3496857668069424e-05,8.62747095067919e-05,3.0137208990968895e-05,7.541660098857912e-05,4.527939199761022e-05
|
||||
5,gelatinous,6.577880965619697e-07,1.300876115839117e-06,1.4086507625116999e-06,2.0936527675985417e-06,2.1166140616709787e-06,6.835318251725247e-07,1.8606867188607014e-06,1.1771548936881767e-06
|
|
Before Width: | Height: | Size: 41 KiB After Width: | Height: | Size: 51 KiB |
|
@ -0,0 +1,6 @@
|
|||
,word,stdev,mean,median,mode,range,q1,q3,iqr
|
||||
0,spectacle,3.2429480879403344e-06,6.771791915744198e-06,5.856699804748392e-06,9.107587857215549e-06,9.845617114478955e-06,3.648670623793545e-06,9.891341051115887e-06,6.242670427322342e-06
|
||||
1,barrel,2.6416769296902955e-06,1.0432005746376187e-05,9.527937696215563e-06,7.765911732349196e-06,9.6085587496678e-06,8.310214460444903e-06,1.2381324755291903e-05,4.071110294847e-06
|
||||
2,crosshair,2.152426057712579e-08,1.5914903575085475e-08,5.3222470557707476e-09,0.0,8.227395552142167e-08,4.1986572948563404e-10,2.353045441034445e-08,2.3110588680858816e-08
|
||||
3,glue,9.470770325185394e-07,2.7773073278273166e-06,2.5182879507415886e-06,2.1983999829444656e-06,3.7563733436789855e-06,2.09432297992862e-06,3.648930923342656e-06,1.554607943414036e-06
|
||||
4,gluestick,5.707736028592825e-10,2.327464443991583e-10,0.0,0.0,2.8080463192787467e-09,0.0,5.2799550446077805e-11,5.2799550446077805e-11
|
|
Before Width: | Height: | Size: 39 KiB After Width: | Height: | Size: 52 KiB |
Before Width: | Height: | Size: 25 KiB After Width: | Height: | Size: 29 KiB |
Before Width: | Height: | Size: 25 KiB After Width: | Height: | Size: 34 KiB |
201
python/data-science/twitchrevenue.csv
Normal file
|
@ -0,0 +1,201 @@
|
|||
,channelName,totalSubs,totalCostOfSubs,twitchCuts,totalEarnings
|
||||
1,RanbooLive,114322.0,407894.94,203289.94,255807.5
|
||||
2,xQcOW,75139.0,125059.43000000001,62176.93000000001,147895.0
|
||||
3,NICKMERCS,57700.0,152240.45,75327.95000000001,111122.5
|
||||
4,HasanAbi,55035.0,98657.06000000001,49009.56000000001,92175.0
|
||||
5,Gaules,,,,
|
||||
6,AdinRoss,50336.0,118728.38,59193.380000000005,98737.5
|
||||
7,ibai,45868.0,86787.28,43247.28,113835.0
|
||||
8,auronplay,45048.0,104293.63,51931.130000000005,102075.0
|
||||
9,Sintica,,,,
|
||||
10,summit1g,37416.0,97974.54,48624.53999999999,77382.5
|
||||
11,casimito,31117.0,26008.17,12968.169999999998,68585.0
|
||||
12,MontanaBlack88,29022.0,67276.32,33526.32000000001,66227.5
|
||||
13,Repullze,,,,
|
||||
14,Trainwreckstv,26336.0,79507.26,39592.259999999995,57235.0
|
||||
15,Philza,,,,
|
||||
16,chowh1,23925.0,96620.56,48013.06,58110.0
|
||||
17,ludwig,,,,
|
||||
18,LVNDMARK,23681.0,67420.27,33157.770000000004,56697.5
|
||||
19,juansguarnizo,23228.0,58643.91,29198.910000000003,51982.5
|
||||
20,Amouranth,22648.0,81019.78000000001,40312.28000000001,52667.5
|
||||
21,Odablock,,,,
|
||||
22,Anastasia_Rose_Official,,,,
|
||||
23,MOONMOON,21247.0,57008.29,27768.29,51417.5
|
||||
24,Sykkuno,21221.0,78462.95000000001,38932.95000000001,50885.0
|
||||
25,alanzoka,20862.0,16598.640000000003,8188.640000000003,46437.5
|
||||
26,moistcr1tikal,20171.0,59665.64000000001,29538.140000000007,47617.5
|
||||
27,Mizkif,20121.0,44622.18,22192.18,39840.0
|
||||
28,PaymoneyWubby,20000.0,71592.23000000001,35454.73000000001,47950.0
|
||||
29,iiTzTimmy,19913.0,64737.439999999995,32194.939999999995,47077.5
|
||||
30,AdmiralBahroo,19484.0,47963.520000000004,23683.520000000004,37547.5
|
||||
31,LIRIK,19105.0,37611.05,18706.050000000003,42947.5
|
||||
32,TheRealKnossi,18350.0,44991.15,22401.15,41780.0
|
||||
33,richwcampbell,18315.0,72018.12,35813.119999999995,44652.5
|
||||
34,Pestily,17857.0,80125.3,39460.3,47625.0
|
||||
35,JLTomy,17391.0,49641.950000000004,24709.450000000004,39565.0
|
||||
36,Locklear,17327.0,58711.4,29118.9,41695.0
|
||||
37,BobbyPoffGaming,,,,
|
||||
38,VooDooSh,16978.0,86177.05000000002,42752.05000000002,43542.5
|
||||
39,MckyTV,16962.0,51698.200000000004,25703.200000000004,40060.0
|
||||
40,tommyinnit,16774.0,40335.450000000004,20082.950000000004,32392.5
|
||||
41,LuckyChamu,,,,
|
||||
42,TimTheTatman,16658.0,45007.03999999999,22377.039999999994,37942.5
|
||||
43,Zoomaa,,,,
|
||||
44,RATIRL,16326.0,58901.01,28901.010000000002,40712.5
|
||||
45,LosPollosTV,16197.0,54406.64,27119.14,37705.0
|
||||
46,BruceGreene,,,,
|
||||
47,Kamet0,15702.0,40260.38,20042.879999999997,35900.0
|
||||
48,Tubbo,15578.0,65685.61,32683.11,39605.0
|
||||
49,alexelcapo,15500.0,19126.930000000004,9536.930000000004,34825.0
|
||||
50,Jerma985,15261.0,33834.01,16804.010000000002,34757.5
|
||||
51,GRONKH,15062.0,44627.149999999994,22229.649999999994,34997.5
|
||||
52,scump,15009.0,56338.27,28058.269999999997,35410.0
|
||||
53,Rubius,14812.0,30555.460000000003,15155.460000000003,33820.0
|
||||
54,WELOVEGAMES,,,,
|
||||
55,NoWay4u_Sir,14613.0,23085.920000000002,11418.420000000002,33367.5
|
||||
56,loltyler1,14604.0,26793.05,13285.55,33295.0
|
||||
57,buddha,14522.0,51802.63,25787.629999999997,34017.5
|
||||
58,ZeratoR,14502.0,46808.46000000001,23273.460000000006,33747.5
|
||||
59,GernaderJake,,,,
|
||||
60,Elraenn,14319.0,27696.25,13731.25,32882.5
|
||||
61,CohhCarnage,14280.0,54026.46000000001,26753.960000000006,35877.5
|
||||
62,Dhalucard,14165.0,56116.170000000006,27841.170000000006,34907.5
|
||||
63,Cellbit,14129.0,22784.54,11362.04,31717.5
|
||||
64,Asmongold,13901.0,35161.560000000005,17451.560000000005,32227.5
|
||||
65,BruceDropEmOff,,,,
|
||||
66,elxokas,,,,
|
||||
67,IlloJuan,,,,
|
||||
68,Ramee,,,,
|
||||
69,WilburSoot,13384.0,46532.850000000006,23187.850000000006,31102.5
|
||||
70,RatedEpicz,13246.0,48165.71000000001,23938.210000000006,31527.5
|
||||
71,eliasn97,13212.0,23423.570000000003,11671.070000000003,29975.0
|
||||
72,wtcN,13107.0,26817.920000000006,13295.420000000006,30077.5
|
||||
73,TSM_ImperialHal,12655.0,41339.46,20521.96,29725.0
|
||||
74,exzachtt,,,,
|
||||
75,ElMariana,12447.0,25579.03,12749.029999999999,27610.0
|
||||
76,Tumblurr,12409.0,22470.910000000003,11165.910000000003,28527.5
|
||||
77,ShahZaM,12347.0,29183.42,14468.419999999998,28640.0
|
||||
78,Trymacs,12273.0,14955.39,7452.889999999999,27092.5
|
||||
79,Tectone,,,,
|
||||
80,chessbrah,,,,
|
||||
81,Lysium,,,,
|
||||
82,Shotz,11728.0,54672.51,27177.510000000002,29200.0
|
||||
83,DarioMocciaTwitch,11673.0,14461.78,7176.780000000001,26202.5
|
||||
84,TeePee,11508.0,40383.83,19888.83,28110.0
|
||||
85,Ailenax,,,,
|
||||
86,AussieAntics,,,,
|
||||
87,Jelty,11281.0,23383.7,11641.2,25307.5
|
||||
88,Aydan,11152.0,45151.090000000004,22453.590000000004,26920.0
|
||||
89,sodapoppin,10988.0,24732.28,12252.279999999999,25097.5
|
||||
90,forsen,10988.0,28190.88,13980.880000000001,25152.5
|
||||
91,Maximilian_DOOD,10966.0,34722.69,17257.690000000002,25445.0
|
||||
92,Swagg,10951.0,41583.5,20703.5,25805.0
|
||||
93,Zerkaa,,,,
|
||||
94,PENTA,10711.0,43194.31,21524.309999999998,25752.5
|
||||
95,shroud,10539.0,22785.58,11303.080000000002,23710.0
|
||||
96,Punz,,,,
|
||||
97,PietSmiet,10346.0,34238.090000000004,17018.090000000004,24775.0
|
||||
98,loud_coringa,10273.0,19825.420000000002,9887.920000000002,22910.0
|
||||
99,jbzzed,10254.0,40585.26,20175.260000000002,25045.0
|
||||
100,Staryuuki,10240.0,48295.19,24015.190000000002,25737.5
|
||||
101,ShoXx__,,,,
|
||||
102,TheGrefg,10094.0,17300.52,8623.02,22687.5
|
||||
103,SmallAnt,,,,
|
||||
104,AnEternalEnigma,,,,
|
||||
105,KYR_SP33DY,9986.0,34368.82,17031.32,24012.5
|
||||
106,CriticalRole,9850.0,24556.89,12221.89,21622.5
|
||||
107,Sapnap,9782.0,39645.89000000001,19768.390000000007,23117.5
|
||||
108,fps_shaka,9773.0,9461.77,4686.77,15352.5
|
||||
109,BarbarousKing,9702.0,36730.5,18143.0,23797.5
|
||||
110,mang0,9688.0,33983.79,16888.79,22920.0
|
||||
111,Sweatcicle,,,,
|
||||
112,Kyle,,,,
|
||||
113,GsxrClyde,,,,
|
||||
114,ProblemWright,,,,
|
||||
115,CDNThe3rd,9326.0,36245.0,17970.0,22775.0
|
||||
116,Moonryde,,,,
|
||||
117,Ponce,9210.0,26992.230000000003,13427.230000000003,21187.5
|
||||
118,ZanoXVII,9200.0,6317.54,3142.54,20330.0
|
||||
119,Shlorox,9104.0,30790.82,15265.82,21867.5
|
||||
120,GTAWiseGuy,,,,
|
||||
121,ELoTRiX,9075.0,32711.510000000002,16231.510000000002,21917.5
|
||||
122,YoDa,9003.0,8253.67,4108.67,20050.0
|
||||
123,dmajszi,,,,
|
||||
124,GrandPOObear,8899.0,39816.310000000005,19818.810000000005,21982.5
|
||||
125,RayNarvaezJr,8884.0,37642.58,18445.08,23170.0
|
||||
126,Whippy,,,,
|
||||
127,AnnieFuchsia,,,,
|
||||
128,MAZA4KST,,,,
|
||||
129,Agraelus,8601.0,38918.24,19373.239999999998,20495.0
|
||||
130,knekro,8565.0,13029.53,6472.030000000001,19442.5
|
||||
131,IceManIsaac,,,,
|
||||
132,Kiva,,,,
|
||||
133,Gotaga,8461.0,26732.61,13295.11,19797.5
|
||||
134,KendineMuzisyen,8452.0,11358.210000000001,5623.210000000001,18940.0
|
||||
135,DavidLafargeOFF,,,,
|
||||
136,RonnieRadke,,,,
|
||||
137,KarmikKoala,8264.0,42784.71,21092.21,21820.0
|
||||
138,AvoidingThePuddle,8228.0,22536.750000000004,11179.250000000004,19110.0
|
||||
139,DiazBiffle,,,,
|
||||
140,Reborn_Live,8204.0,38675.24,19125.239999999998,21737.5
|
||||
141,mistermv,8174.0,19982.280000000002,9879.780000000002,18910.0
|
||||
142,MYM_ALKAPONE,8160.0,13233.94,6581.4400000000005,18285.0
|
||||
143,TobiasFate,8144.0,20994.38,10406.880000000001,19100.0
|
||||
144,Timmac,,,,
|
||||
145,Tfue,8009.0,23124.820000000003,11487.320000000003,18502.5
|
||||
146,Kitboga,7979.0,27207.32,13497.32,18992.5
|
||||
147,TheNicoleT,,,,
|
||||
148,IamCristinini,7909.0,28928.190000000002,14383.190000000002,19140.0
|
||||
149,Papaplatte,7875.0,10025.39,4985.389999999999,17780.0
|
||||
150,melharucos,7820.0,43778.520000000004,21341.020000000004,22567.5
|
||||
151,Foolish_Gamers,7817.0,32530.76,16193.259999999998,18800.0
|
||||
152,cloakzy,7745.0,26792.460000000003,13322.460000000003,17955.0
|
||||
153,Snip3down,,,,
|
||||
154,Castro_1021,7680.0,20310.190000000002,10095.190000000002,17497.5
|
||||
155,Amar,,,,
|
||||
156,CPentagon,,,,
|
||||
157,Ninja,7602.0,20370.23,10120.23,17575.0
|
||||
158,AnniTheDuck,7552.0,27461.27,13648.77,18222.5
|
||||
159,Quin69,7541.0,27188.57,13403.57,18675.0
|
||||
160,Atrioc,,,,
|
||||
161,JesusAVGN,7517.0,36308.85,18056.35,18380.0
|
||||
162,fuslie,,,,
|
||||
163,capturesca,,,,
|
||||
164,sweetdreams,7403.0,32083.11,15928.11,18395.0
|
||||
165,elded,7398.0,19009.29,9424.29,17132.5
|
||||
166,RvNxMango,,,,
|
||||
167,Altair,7293.0,30255.3,14795.3,19135.0
|
||||
168,JASONR,7291.0,31982.190000000002,15894.690000000002,18045.0
|
||||
169,Smzinho,7142.0,6741.840000000001,3346.840000000001,15865.0
|
||||
170,FolagorLives,7130.0,18832.49,9387.490000000002,17892.5
|
||||
171,Radlerauge,,,,
|
||||
172,Mystixx,,,,
|
||||
173,Dropped,,,,
|
||||
174,Sequisha,,,,
|
||||
175,Putupau,6981.0,15199.86,7569.860000000001,15842.5
|
||||
176,LuluLuvely,,,,
|
||||
177,Sardoche,6818.0,15524.96,7702.459999999999,15580.0
|
||||
178,POW3Rtv,6784.0,7974.63,3949.63,15152.5
|
||||
179,xRohat,,,,
|
||||
180,BabyBouge,,,,
|
||||
181,SypherPK,6700.0,20929.13,10389.130000000001,16547.5
|
||||
182,pqueen,,,,
|
||||
183,pokimane,6607.0,23795.609999999997,11690.609999999997,16150.0
|
||||
184,Elajjaz,6603.0,20745.18,10280.18,15652.5
|
||||
185,bt0tv,6597.0,17245.61,8600.61,15140.0
|
||||
186,sleepy,,,,
|
||||
187,Perxitaa,6577.0,25818.399999999998,12878.399999999998,15752.5
|
||||
188,HellYeahPlay,,,,
|
||||
189,FrostPrime_,,,,
|
||||
190,HusKerrs,6567.0,24337.15,12102.150000000001,15712.5
|
||||
191,Domingo,6566.0,18433.86,9163.86,14927.5
|
||||
192,TrilluXe,6565.0,33259.35,16554.35,16705.0
|
||||
193,stylishnoob4,6522.0,10648.88,5303.879999999999,14672.5
|
||||
194,NeskWgA,,,,
|
||||
195,RoyalPhunk,6404.0,26293.970000000005,13056.470000000005,15752.5
|
||||
196,sargentocharli,,,,
|
||||
197,MissJuneDJ,,,,
|
||||
198,Spofie,,,,
|
||||
199,firedancer,,,,
|
||||
200,elwycco,6267.0,30529.84,15194.84,15437.5
|
|
446
python/gd-two-star-list/2stars.csv
Normal file
|
@ -0,0 +1,446 @@
|
|||
6508283,ReTraY,4521656
|
||||
4454123,Sonar,3507652
|
||||
26618473,Promises,3187364
|
||||
11280109,Dark Paradise,3069266
|
||||
11630859,ThE WorLd,1381964
|
||||
2867632,lucid dream,1365470
|
||||
21923305,Ocean Of Dreams,1098831
|
||||
23356701,Warmth,1034024
|
||||
11945914,SUNSET,962866
|
||||
1729,DARKNESS,884574
|
||||
13935609,a spark of life,837582
|
||||
2546328,Flappy Jumper 2,782825
|
||||
2443491,xDARKx,778718
|
||||
14074637,feather,764303
|
||||
10970301,Bright Eclipse,708210
|
||||
12194579,For Science,641082
|
||||
26561853,When The Leaves Fall,640159
|
||||
977287,Stageix,614428
|
||||
3325797,Findexis Madness 2,591227
|
||||
9787477,Gawne Forever,564121
|
||||
14485066,Paint on Track,540424
|
||||
70196,Practice Level,539984
|
||||
11941828,Practice domination,510846
|
||||
3945967,Moving Obstacles,497291
|
||||
12640275,Dream of Night,471024
|
||||
14206606,Paint Madness,468483
|
||||
14375455,Colory,454957
|
||||
1842894,Flight Of Space 1,437931
|
||||
32400752,IZnite,435313
|
||||
13241784,dorabae-quiz,435089
|
||||
1239645,Invisible on track,412731
|
||||
13226698,Whirlwind,409452
|
||||
16754209,Geometry Dance,394725
|
||||
2816038,Stereo Madness 2,378790
|
||||
7894312,PeAsY WoRlD II,372023
|
||||
14325059,Universe,366693
|
||||
13935221,Gravity Falls,365092
|
||||
6458589,If Cataclysm was L1,346492
|
||||
14116476,Never Be Alone,346327
|
||||
12638235,Serene time,332516
|
||||
14307902,Whipped Cream,332502
|
||||
13318490,Adrift,322709
|
||||
11686946,Never Be Alone,309575
|
||||
3049084,pur1ty ,298129
|
||||
12993248,Super Mario Galaxy,297973
|
||||
15650565,Sacred Crescent,285043
|
||||
6392228,flappy crystal,283458
|
||||
13455501,AlterGame,281857
|
||||
13113862,Blossoms,278342
|
||||
12725323,Aurora,273718
|
||||
52128,1,263654
|
||||
2410286,ECOnomix,256016
|
||||
13296070,StarLight,252670
|
||||
7828357,Traum,249860
|
||||
14015303,DragonS,249652
|
||||
18628381,The Calling ,248580
|
||||
17806788,Fantasy,237780
|
||||
14256752,iEuPhoriai,237117
|
||||
34749502,Candescent,236938
|
||||
15091600,SuPernoVa,234688
|
||||
8663057,Hyper Dream,231046
|
||||
26758645,lonely,229333
|
||||
5226832,Divine Airflow,221538
|
||||
1757461,IF Clubstep was Lv1,218625
|
||||
17250385,Xenogenesis,218246
|
||||
8242166,Mario bros,217259
|
||||
6956751,flappy emerald,215830
|
||||
34224737,Wishless,213496
|
||||
13506658,Lullaby,212944
|
||||
8795831,Flappy bird,212089
|
||||
274283,Demons,209011
|
||||
33541887,Flore,202993
|
||||
17496044,AlterGame IV,202052
|
||||
13059832,Luminous,198118
|
||||
23454590,Sadness,193643
|
||||
14152721,rEd OrIgIn,191431
|
||||
5356370,Glow Surface,190367
|
||||
6709812,Flappy Rubins,186555
|
||||
14250437,Determination,186431
|
||||
33178604,Flickering,184211
|
||||
18257585,Airflow,183398
|
||||
18974476,Hill Climb Racing,178418
|
||||
16724793,Never be alone,178128
|
||||
15778799,OccasuS,176228
|
||||
9227947,Minecraft Life,172720
|
||||
6767410,Sapphire,169830
|
||||
27091198,Beautiful Now,168164
|
||||
25325495,Exploration,165572
|
||||
35844907,Tic Tac Toe,164099
|
||||
28601858,Cosmos,163154
|
||||
22054803,Airwaves,162572
|
||||
32287561,Dreams,161118
|
||||
13626540,ambience,160174
|
||||
16294328,Ghostbusters III,157837
|
||||
17649626,Hepatica,154132
|
||||
14048440,iIiBlushiIi,151488
|
||||
8101206,TopaZ,151469
|
||||
7321011,Flappy Sapphire,148433
|
||||
27553978,Forever,147975
|
||||
20694170,100 Millionth Level,147570
|
||||
34413161,Nevermind,146827
|
||||
4193687,If TOE2 was level 1,146053
|
||||
33932022,Amnesty,144843
|
||||
33855024,Soothe,140554
|
||||
37074698,Escape,139917
|
||||
7156598,Cosmic Dolphin,135428
|
||||
6373869,BdoubleO,134301
|
||||
15742990,Ramoth,131358
|
||||
25126221,Unknown,130981
|
||||
6739392,Stardrive ,130463
|
||||
26509337,bright light,130304
|
||||
3380956,Stereo Madness 2,127255
|
||||
34447420,Easy Seas,123472
|
||||
16477137,Deviant,123459
|
||||
1598815,Stereo Demoness,122438
|
||||
25849693,Alpha,121158
|
||||
50978,Rainforest,120273
|
||||
27986788,Hibernation,119630
|
||||
35494138,Vapored,119344
|
||||
17846717,Journey,118937
|
||||
16340126,Unicorn of the Sea,118247
|
||||
14885507,Limitless,118119
|
||||
27131405,Orbis,113375
|
||||
10679248,Super Mario World,109915
|
||||
2978563,Stereo Madness 2,108162
|
||||
18309012,Pokemon Battle V3,106651
|
||||
30940090,Lonely Heart,106046
|
||||
17264945,BiolumInesCenT,106023
|
||||
3578207,Electro Replica BoT,103694
|
||||
37158612,Canon,102780
|
||||
36216543,FOOD LAND,102121
|
||||
9844705,Time Glitch,101069
|
||||
27773001,Road of Vanishing,100832
|
||||
40946217,Tragic End,100826
|
||||
28420508,Double Triple Trial,100592
|
||||
16517491,Climate Cartoon,99730
|
||||
9977762,Cosmic dreamer,97127
|
||||
7433575,Surfing The Wind,96198
|
||||
11837963,windfall,94625
|
||||
34044719,Thoughtless,94581
|
||||
9224105,Keys,91476
|
||||
269331,Mono Madness,91296
|
||||
8891941,Asleep,91093
|
||||
7366219,World Of Fantasy,89680
|
||||
15171074,XMas Challenge,88276
|
||||
31674919,Lonely,87174
|
||||
34911518,Metaverse,86658
|
||||
9442809,Gawne returns,85796
|
||||
11806250,Poltergeist wave,85247
|
||||
33985856,Aporia,85195
|
||||
3943870,Easy Stereo Madness,84977
|
||||
67381,lode gate,84222
|
||||
11433327,Happy Hour,83830
|
||||
156124,Dash of dash 2,81958
|
||||
10659339,Space Galaxy,81852
|
||||
34238194,Gloomy Forest,81304
|
||||
35937985,ANoxia,80437
|
||||
1589851,back on future,78924
|
||||
25673838,Oncove,78546
|
||||
9098488,Gawne,76528
|
||||
3747620,Stereo Madness V2,75561
|
||||
7883168,Force Of Fantasy,71942
|
||||
30434082,Space Expedition,69373
|
||||
51173274,weird,67565
|
||||
39502342,Mizu,67488
|
||||
39101602,Sentience,67237
|
||||
8405457,Surface,66963
|
||||
33200652,Fairia,65925
|
||||
9227843,xcropolis,65662
|
||||
34799197,For You,65514
|
||||
62073,soft mountion,65347
|
||||
15173182,Paradise Lost ,64986
|
||||
36652594,Mirage,64810
|
||||
37322842,Honey Moon,64590
|
||||
10657894,Glorious Morning,64311
|
||||
6229146,PeacefullY,64176
|
||||
11130144,Robot Madness,64083
|
||||
42986230,E,63736
|
||||
65109444,Nice,61945
|
||||
9539030,Crispy Game,59947
|
||||
13405010,Fantasia,59819
|
||||
3538583,Glitter Madness 2,59795
|
||||
19592976,Virtual Stimulus,58992
|
||||
18093873,Monody,57017
|
||||
11064188,20 madness,56799
|
||||
6431528,BdoubleO,55985
|
||||
91556,csmmmm xdd,55969
|
||||
11813110,time travel,55844
|
||||
40138985,4 AM,54634
|
||||
57551137,Ayu,54214
|
||||
55037478,Serponge Look At Me,53921
|
||||
11777209,Hallowed Ocean,53811
|
||||
9085581,Stereo Madness V2,53103
|
||||
244079,Abc,52832
|
||||
54664621, TIA,52332
|
||||
12282802,The NighT,52274
|
||||
1174225,Analogue Madness,52190
|
||||
8354764,aqua of miracle,49380
|
||||
59760047,Less than three,49269
|
||||
14719029,Telluric,49057
|
||||
42088280,Trees II,48796
|
||||
20271866,Wolheimers Triumph,48309
|
||||
155463,practice step,47995
|
||||
21968268,Exitus,47353
|
||||
8919336,aqua marine,47238
|
||||
11660471,Sweet Dreams,46502
|
||||
50341465,Abre Tus Ojos,46264
|
||||
49045979,Danfins,45820
|
||||
69582529,Coeur Lambeaux,45661
|
||||
14958919,TrIsTerY,45438
|
||||
9316079,The Lonely Life ,44945
|
||||
17648856,Buckle Your pants,44834
|
||||
14385242,Abyss II,44719
|
||||
9697146,Dancing Moonman,44589
|
||||
38348152,Shaded Forest,44405
|
||||
8099154,Golden Haze,44161
|
||||
4078954,Easy Back On Track,43064
|
||||
67661363,Geometry Dash,42849
|
||||
18638877,Romantique,41918
|
||||
66152948,Monody,39640
|
||||
12191390,never alone,38383
|
||||
137233,Geometry Level 1,38052
|
||||
14653485,Freedom,38029
|
||||
13767461,The Eighth,38013
|
||||
35750087,Choo,37960
|
||||
27613882,Feelings,37904
|
||||
6617563,Stereo Madness 2 ,36897
|
||||
14375184,Madness,36862
|
||||
25081326,New Stereo Madness,36550
|
||||
11863768,Archaic Cosmos,36500
|
||||
18663466,BuBBle GuM,36498
|
||||
10212504,Sunset Valley,36105
|
||||
9112375,Essence of Light,36101
|
||||
55976208,Aulta,36080
|
||||
14355897,Colour Tales,35864
|
||||
219906,joloflip,34085
|
||||
17570659,new Planet New World,33949
|
||||
55215779,Aer,33699
|
||||
48054705,Sagirism,33213
|
||||
47579492,Ongaku,33141
|
||||
49219688,Owo,33036
|
||||
20336469,After World,32516
|
||||
172810,RAINBOW white,32406
|
||||
22199039,Wisp,32313
|
||||
14409896,Paper world,32255
|
||||
44568447,Conclusion,32253
|
||||
216004,banana milk 1,32190
|
||||
13699131,Magnetoscope,32168
|
||||
54476612,Frostbite,32085
|
||||
13374719,ApeX,31682
|
||||
15666330,Lost memories,31193
|
||||
55283238,Jessy ,30892
|
||||
56974779,Unbend,29924
|
||||
13077712,Telescope,29725
|
||||
13322137,SpaceDream,29508
|
||||
60791071,Cinnamon,29444
|
||||
16139525,GoodbyE Fi,29335
|
||||
60092456,Arcane River,29136
|
||||
49899508,Relaxation,28953
|
||||
68263042,Distant Horizon,28780
|
||||
60087537,Anymore,28256
|
||||
14341100,The Nova,28231
|
||||
159932,Polargiest Easy,28088
|
||||
137573,fly master 1,28066
|
||||
18152461,Paradise,27963
|
||||
11306807,Paper Mario TTYD,27690
|
||||
65707442,The Woods,27320
|
||||
54925887,Hal,26619
|
||||
66539851,Swag City,26489
|
||||
15661129,Remembered,25874
|
||||
50916119,Lost,25734
|
||||
48049215,Yousei,25604
|
||||
216159,desert run,25436
|
||||
58521673,Lisa,25243
|
||||
52604345,Awe,25033
|
||||
15029162,SpArEd,24824
|
||||
66149804,Emily Blunt,24773
|
||||
52195963,Nostalgia,24674
|
||||
9479326,VietNam Wonders,24635
|
||||
37659783,Meiria,24631
|
||||
13704968,SkyColor,24580
|
||||
13146798,Forest Adventure I,24432
|
||||
49924382,A Distand Melody,24151
|
||||
64803948,Sneaky Snake,23513
|
||||
13400251,THE SUNRISE,23317
|
||||
13367607,My World,23259
|
||||
14370126,Sweet Christmas,23197
|
||||
67463002,Felicity,23055
|
||||
35186842,Shakey Boss Fight,22946
|
||||
58977211,thespikeisoverthere,22714
|
||||
47346090,Flip,22623
|
||||
57545756,Buglo,22545
|
||||
56458670,Hold,22519
|
||||
51455232,impulsive surrounds,22211
|
||||
57047877,Terra,22116
|
||||
13146729,Feist,21875
|
||||
120652,stairs,21856
|
||||
7507591,Your Prelude r2,21826
|
||||
70296287,Enchanted Adventure,21803
|
||||
62374745,little soul,21229
|
||||
49623654,Domi,20933
|
||||
52321279,Lack of Time,20172
|
||||
55731749,Lovely,19952
|
||||
12522005,Dream Catcher,19867
|
||||
56893141,Dream,19786
|
||||
57061521,Broom Journey,19643
|
||||
50641318,Christmas Storm,18813
|
||||
54479697,A P P II,18797
|
||||
66766246,spike spike spike,18500
|
||||
60467278,Nelis100,18452
|
||||
58548056,Quiaet,18059
|
||||
66944745,Seven Burgers,17768
|
||||
50952421,Fika,17738
|
||||
63553770,Anna,17534
|
||||
69049060,Dissonance,17400
|
||||
11542127,Thousand Engine,17385
|
||||
67315935,microphone,17366
|
||||
51658696,Made in,16859
|
||||
54611457,Aspire,16610
|
||||
54801141,Smooth,16508
|
||||
50995063,Absi,16425
|
||||
59177605,TranquillitY,16287
|
||||
64153806,Moment,15964
|
||||
59073467,Paracity,15962
|
||||
62743002,Split Path,15889
|
||||
37182888,Future Life,15757
|
||||
56253412,Relaxing Paradise,15062
|
||||
64103157,extreme demon,14843
|
||||
62095015,Diverge,14837
|
||||
49807324,Ikra ,14228
|
||||
58195391,ayup,14109
|
||||
59032507,Ocarina,13521
|
||||
59708310,Magical,13195
|
||||
70174316,My Little Angel,12994
|
||||
69701323,Actual,12836
|
||||
66539358,Frappuccino,12799
|
||||
61167144,Wonder,12463
|
||||
52577127,refresh,12323
|
||||
55825525,Pure of Heart,12301
|
||||
57933522,Keep it Simple,11997
|
||||
58107944,Sacha,11983
|
||||
65270192,Rosa,11814
|
||||
64056232,Always You,11615
|
||||
59561688,LoVe II,11521
|
||||
58201541,Ascension,11478
|
||||
59957442,GoodBye,11433
|
||||
55831636,Negativo,10996
|
||||
61203856,Windless,10862
|
||||
57299546,Palermo,10759
|
||||
61174095,The Wisp,10751
|
||||
57958302,SpO0kY,10690
|
||||
56753706,Krasnodar Region,10420
|
||||
44083098,Lemons,10397
|
||||
65624034,Up to five,10391
|
||||
55929353,Dreary,10309
|
||||
68179284,DaBaby,9938
|
||||
58014525, ,9840
|
||||
55093553,Jacuzzi,9698
|
||||
57872755,Re,9662
|
||||
69531518,Castle,9561
|
||||
70447528,Love of flight,9527
|
||||
57052078,easy,9522
|
||||
69079023,Lonelian,9425
|
||||
62906370,716,9383
|
||||
58439494,Seventy Nine,9340
|
||||
65895417,WinteR,9316
|
||||
64718148,Pocket Infinity,9238
|
||||
63724244,Namice,9100
|
||||
62056335,World Record,8754
|
||||
65625598,25 I 12 I 20 ,8452
|
||||
61493494,A little dream,8419
|
||||
59715641,Heartache,8393
|
||||
63634297,Chrome II,8364
|
||||
65226411,Fullness,8342
|
||||
63371156,feeding time,8295
|
||||
60026412,Midnight Vibes,8224
|
||||
66012376,Monolith,8097
|
||||
66802514,EthereaL,8052
|
||||
69069448,Allay,7996
|
||||
62306378,wasteland,7923
|
||||
62865428,Awe,7837
|
||||
66230315,Parapolis,7714
|
||||
65235417,Agua Nocturno,7712
|
||||
68899885,uplift,7620
|
||||
58841839,Varying Christmas,7557
|
||||
67702859,Squidely Dream,7533
|
||||
65574708,COOL,7510
|
||||
68784158,Flashing Trip,7492
|
||||
64279419,ABC,7422
|
||||
51674687,NoTsRs,7410
|
||||
67853336,Szymon Kalisz,7319
|
||||
56728108,Somewhere in Peru,7294
|
||||
57016061,harmonious,7178
|
||||
64743797,Your So Good at Golf,7128
|
||||
70069393,Relax Zone,7005
|
||||
64886856,happy halloween,6911
|
||||
68629740,peace,6701
|
||||
65758217,Chronology,6519
|
||||
70856801,Danny,6447
|
||||
67386414,Mercy,6153
|
||||
64507537,Stride,6101
|
||||
66902477,spirit,6074
|
||||
71257097,Forever and ever,5990
|
||||
67881256,An Ominous Walk,5952
|
||||
68543406,Honda Civic,5648
|
||||
65769212,abroad,5634
|
||||
67575144,sunset,5460
|
||||
67585420,Interlude I,5353
|
||||
60521512,Loth,5321
|
||||
71056684,falling apart,5136
|
||||
68890229,Great,4812
|
||||
61013776,the button,4780
|
||||
67651373,Fur Mmath,4759
|
||||
69003687,Rice,4751
|
||||
67052198,Algophobia,4709
|
||||
65603278,ColorBlast,4678
|
||||
68079038,PuritY,4604
|
||||
64932898,Anemone,4590
|
||||
67180546,Snowbound,4500
|
||||
65177675,Huawei,4450
|
||||
66210744,excel,4358
|
||||
65984942,1 800 NOSTALGIA,4328
|
||||
69732552,Spectral Calamity,4313
|
||||
67598567,Squimbus,4268
|
||||
65351469,Tethys,4122
|
||||
70584466,Cloud Surfin,4029
|
||||
68044624,Blefuscu,3926
|
||||
70149360,Xstar7,3816
|
||||
71186483,Reverse rain,3758
|
||||
66046798,WORLD WARP,3737
|
||||
66267209,Ausks New Boat,3564
|
||||
67511827,Memori,3523
|
||||
66239080,dilute illusion,3480
|
||||
75944,back ond karim,3266
|
||||
70257328,Looja,3220
|
||||
68982262,Idibus Martiis,3182
|
||||
70461662,slowness,2379
|
||||
109953,stereo madless,-876
|
||||
206530,Frozen Netherlands,-1288
|
||||
219938,Area 51,-5005
|
||||
174270,Cycles Polargeist,-7470
|
||||
84592,sky run,-7900
|
||||
218497,google,-11992
|
||||
448229,geometry dash quiz,-29612
|
||||
68184,Challenge,-59445
|
||||
293446,Extreme Disaster,-61297
|
|
45
python/pp.py
Normal file
|
@ -0,0 +1,45 @@
|
|||
import oppaipy
|
||||
import requests
|
||||
import os
|
||||
|
||||
# Request information about the beatmap
|
||||
id = input('Please enter a beatmap ID: ').strip()
|
||||
beatmap = requests.get('https://osu.ppy.sh/osu/{0}'.format(id)) # Fetch the osu file
|
||||
open('{0}.osu'.format(id), 'w').write(beatmap.text.replace('\n', '')) # Write this difficulty to the disk
|
||||
lines = open('{0}.osu'.format(id), 'r').readlines() # Read the lines of the osu file
|
||||
artist = [x[7:len(x)].strip() for x in lines if x.startswith('Artist:')][0] # Figure out the artist of the song
|
||||
name = [x[6:len(x)].strip() for x in lines if x.startswith('Title:')][0] # Figure out the name of the song
|
||||
diff = [x[8:len(x)].strip() for x in lines if x.startswith('Version:')][0] # Figure out the difficulty name
|
||||
name = '{0} - {1} [{2}]'.format(artist, name, diff) # Put these three together into a parseable format by osu
|
||||
|
||||
# Calculate beatmap stats
|
||||
calc = oppaipy.Calculator() # Create an instance of the pp calculator
|
||||
calc.set_beatmap('{0}.osu'.format(id)) # Load the newly written difficulty file
|
||||
calc.calculate() # Calculate the stats
|
||||
calc.close() # Close the calculator to save resources
|
||||
|
||||
# Round beatmap stats to be readable
|
||||
stars = {
|
||||
'total': round(calc.stars, 2),
|
||||
'aim': round(calc.aim_stars, 2),
|
||||
'speed': round(calc.speed_stars, 2)
|
||||
}
|
||||
|
||||
pp = {
|
||||
'total': round(calc.pp, 2),
|
||||
'aim': round(calc.aim_pp, 2),
|
||||
'speed': round(calc.speed_pp, 2),
|
||||
'acc': round(calc.acc_pp, 2)
|
||||
}
|
||||
|
||||
# Output information
|
||||
print("""
|
||||
{0} ({1}*)
|
||||
|
||||
{2}* Aim
|
||||
{3}* Speed
|
||||
{4}pp ({5} aim pp, {6} speed pp, {7} acc pp)
|
||||
""".format(name, stars['total'], stars['aim'], stars['speed'], pp['total'], pp['aim'], pp['speed'], pp['acc']))
|
||||
|
||||
# Cleanup by deleting the written difficulty file afterwards
|
||||
os.remove('{0}.osu'.format(id))
|
Before Width: | Height: | Size: 8.2 KiB After Width: | Height: | Size: 13 KiB |
Before Width: | Height: | Size: 13 KiB After Width: | Height: | Size: 13 KiB |
Before Width: | Height: | Size: 85 KiB After Width: | Height: | Size: 125 KiB |
Before Width: | Height: | Size: 4.7 KiB After Width: | Height: | Size: 5.6 KiB |
Before Width: | Height: | Size: 2.3 KiB After Width: | Height: | Size: 2.6 KiB |
Before Width: | Height: | Size: 12 KiB After Width: | Height: | Size: 13 KiB |
Before Width: | Height: | Size: 111 KiB After Width: | Height: | Size: 124 KiB |
|
@ -3,17 +3,17 @@
|
|||
<h1>pythonchallenge.com</h1>
|
||||
</div>
|
||||
|
||||
- [1 - Map](1%20-%20Map.py)
|
||||
- [2 - OCR](2%20-%20OCR.py)
|
||||
- [3 - Equality](3%20-%20Equality.py)
|
||||
- [4 - linkedlist](4%20-%20linkedlist.py)
|
||||
- [5 - Peak Hell](5%20-%20Peak%20Hell.py)
|
||||
- [6 - Channel](6%20-%20Channel.py)
|
||||
- [7 - Oxygen](7%20-%20Oxygen.py)
|
||||
- [8 - Integrity](8%20-%20Integrity.py)
|
||||
- [9 - Good](9%20-%20Good.py)
|
||||
- [10 - Bull](10%20-%20Bull.py)
|
||||
- [11 - 5808](11%20-%205808.py)
|
||||
- [12 - Evil](12%20-%20Evil.py)
|
||||
- [13 - Disproportional](13%20-%20Disproportional.py)
|
||||
- [14 - Italy](14%20-%20Italy.py)
|
||||
- [1 - Map](1%20-%20Map.py)
|
||||
- [2 - OCR](2%20-%20OCR.py)
|
||||
- [3 - Equality](3%20-%20Equality.py)
|
||||
- [4 - linkedlist](4%20-%20linkedlist.py)
|
||||
- [5 - Peak Hell](5%20-%20Peak%20Hell.py)
|
||||
- [6 - Channel](6%20-%20Channel.py)
|
||||
- [7 - Oxygen](7%20-%20Oxygen.py)
|
||||
- [8 - Integrity](8%20-%20Integrity.py)
|
||||
- [9 - Good](9%20-%20Good.py)
|
||||
- [10 - Bull](10%20-%20Bull.py)
|
||||
- [11 - 5808](11%20-%205808.py)
|
||||
- [12 - Evil](12%20-%20Evil.py)
|
||||
- [13 - Disproportional](13%20-%20Disproportional.py)
|
||||
- [14 - Italy](14%20-%20Italy.py)
|
||||
|
|
30
python/readme.md
Normal file
|
@ -0,0 +1,30 @@
|
|||
<div align="center">
|
||||
<img height="256" src="../assets/python.png" alt="">
|
||||
<h1>python</h1>
|
||||
</div>
|
||||
|
||||
### Data Science
|
||||
|
||||
- [Fake Jobs Scraper](data-science/Fake%20Jobs.py)
|
||||
- [Country Population vs Active Facebook Users in the Country](data-science/Facebook.py)
|
||||
- [Estimated Revenue for the top Twitch channels](data-science/Twitch%20Revenue.py)
|
||||
- [ngrams](data-science/ngrams)
|
||||
- [Comparison](data-science/ngrams/comparison/Comparison.py)
|
||||
- [Popularity](data-science/ngrams/popularity/Popularity.py)
|
||||
|
||||
### Calculators
|
||||
|
||||
- [Binomial Distribution](calculators/Binomial%20Distribution.py)
|
||||
- [Karatsuba Algorithm](calculators/Karatsuba%20Algorithm.py)
|
||||
- [Pearson's Product-Moment Correlation Coefficient](calculators/PMCC.py)
|
||||
- [Quadratic nth Term](calculators/Quadratic%20nth%20Term.py)
|
||||
- [Square Root](calculators/SQRT.py)
|
||||
- [Spearman's Rank Correlation Coefficient](calculators/SRCC.py)
|
||||
- [Standard Deviation](calculators/STDEV.py)
|
||||
|
||||
### Other
|
||||
|
||||
- [PP Calculator](pp.py)
|
||||
- [2 Stars List](gd-two-star-list)
|
||||
- [Pong (made with Pygame)](pong)
|
||||
- [pythonchallenge.com](pythonchallenge.com)
|
12
readme.md
|
@ -5,14 +5,12 @@
|
|||
|
||||
> Big code dump. BTEC [The Bonk](https://github.com/GD-NTB/the-bonk). Anything that does not deserve its own repository goes here.
|
||||
|
||||
I do not promise everything will work in here, however if you have any questions about the contents of the honk, don't be scared to [reach out to me on Discord (:](https://discord.gg/brEhN5Y7YK)
|
||||
|
||||
There is a lot of maths in here, be warned.
|
||||
|
||||
### Table of contents
|
||||
|
||||
- [Python](python)
|
||||
- [C++](c++)
|
||||
- [Python](languages/python)
|
||||
- [C](languages/c)
|
||||
- [Java](languages/java)
|
||||
- [Project Euler](euler)
|
||||
- [GCSE Computer Science](school/gcse)
|
||||
- [A-Level Computer Science](school/a-level)
|
||||
- [Royal Institute Computer Science Masterclass 2021](school/royal%20institute)
|
||||
- [r/dailyprogrammer](daily-programmer)
|
||||
|
|
5
renovate.json
Normal file
|
@ -0,0 +1,5 @@
|
|||
{
|
||||
"extends": [
|
||||
"config:base"
|
||||
]
|
||||
}
|
|
@ -1,57 +0,0 @@
|
|||
from __future__ import annotations
|
||||
import matplotlib.pyplot as plt
|
||||
|
||||
def parseValue(value: str):
|
||||
value = value.strip()
|
||||
|
||||
if value.lower() == "true":
|
||||
return True
|
||||
elif value.lower() == "false":
|
||||
return False
|
||||
elif len(value.split(".")) == 2:
|
||||
return float(value)
|
||||
elif value.isnumeric():
|
||||
return int(value)
|
||||
else:
|
||||
return value
|
||||
|
||||
class Data:
|
||||
def __init__(self, fileName: str):
|
||||
with open(fileName, "r") as file:
|
||||
out = [[parseValue(value) for value in line.strip().split(",")] for line in file.readlines()]
|
||||
self.__data = { header: lst for (header, lst) in zip(out[0], zip(*out[1::])) }
|
||||
|
||||
def getHeaderData(self, header: str):
|
||||
"""Get the data under a header, CaSe insensitive"""
|
||||
for realHeader in self.__data.keys():
|
||||
if header.lower() == realHeader.lower():
|
||||
return self.__data[realHeader]
|
||||
|
||||
return None
|
||||
|
||||
def bubbleSort(lst: list, asc: bool = True) -> list:
|
||||
n = len(lst)
|
||||
|
||||
for i in range(n):
|
||||
for j in range(0, n - i - 1):
|
||||
if lst[j] > lst[j + 1]:
|
||||
lst[j], lst[j + 1] = lst[j + 1], lst[j]
|
||||
|
||||
return lst if asc else lst[::-1]
|
||||
|
||||
|
||||
def getHeights(data: Data, male: bool) -> tuple:
|
||||
heights = data.getHeaderData("height")
|
||||
males = data.getHeaderData("male")
|
||||
|
||||
return [height for height, isMale in zip(heights, males) if male == isMale]
|
||||
|
||||
def meanHeight(data: Data, male: bool):
|
||||
heights = getHeights(data, male)
|
||||
return sum(heights) / len(heights)
|
||||
|
||||
sports = Data("sports_data.csv")
|
||||
femaleHeights = bubbleSort(getHeights(sports, False))
|
||||
|
||||
plt.bar([i for i in range(len(femaleHeights))], femaleHeights)
|
||||
plt.savefig('yes.png')
|
Before Width: | Height: | Size: 9.1 KiB |
|
@ -1,29 +0,0 @@
|
|||
from math import log, floor
|
||||
|
||||
class Memoize:
|
||||
"""Helper class to memoize a decorated function."""
|
||||
def __init__(self, function):
|
||||
self.function = function
|
||||
self.memo = {}
|
||||
|
||||
def __call__(self, *args):
|
||||
if not args in self.memo:
|
||||
self.memo[args] = self.function(*args)
|
||||
return self.memo[args]
|
||||
|
||||
@Memoize
|
||||
def pdi(power: int, base: int, number: int) -> int:
|
||||
"""Computes the perfect digital invariant."""
|
||||
return sum(pow((number % pow(base, i + 1) - number % pow(base, i)) / pow(base, i), power) for i in range(0, floor(log(number, base)) + 1))
|
||||
|
||||
def isHappy(number: int, base: int = 10) -> bool:
|
||||
"""Check if a number is happy in a given base. Defaults to base 10."""
|
||||
seen = set()
|
||||
|
||||
while number > 1 and number not in seen:
|
||||
seen.add(number)
|
||||
number = pdi(2, base, number)
|
||||
|
||||
return number == 1
|
||||
|
||||
print(isHappy(19))
|
|
@ -1,10 +0,0 @@
|
|||
def happyCheck(number: int):
|
||||
seen = set()
|
||||
|
||||
while number > 1 and number not in seen:
|
||||
seen.add(number)
|
||||
number = sum(int(digit) ** 2 for digit in list(str(number)))
|
||||
|
||||
return number == 1
|
||||
|
||||
print(happyCheck(19))
|
|
@ -1,20 +0,0 @@
|
|||
def mergeSort(lst: list) -> list:
|
||||
if len(lst) > 1:
|
||||
mid = len(lst) // 2
|
||||
left = lst[:mid]
|
||||
right = lst[mid:]
|
||||
|
||||
mergeSort(left)
|
||||
mergeSort(right)
|
||||
|
||||
i = j = k = 0
|
||||
|
||||
while i < len(left) and j < len(right):
|
||||
if left[i] <= right[j]:
|
||||
lst[k] = left[i]
|
||||
i += 1
|
||||
else:
|
||||
lst[k] = right[j]
|
||||
|
||||
|
||||
print(mergeSort([3,5,2,1]))
|