Skip to content

Instantly share code, notes, and snippets.

@h0059ebp
h0059ebp / Sieve_of_Eratosthenes.java
Created July 4, 2023 20:38
This code lets you calculate all prime number from 2 to a given range.
import java.util.Scanner;
class Sieve_of_Eratosthenes {
public static void main(String[]args) {
Scanner scanner = new Scanner(System.in);
System.out.print("Enter Limit: ");
int i; // Used for determine Position of Array
int p; // Represents currently checked number
@h0059ebp
h0059ebp / Fibonacii_Sequence.java
Created July 4, 2023 20:33
This code lets you calculate the Fibonnaci Sequence up to an entered Point or gives you an exact Position.
import java.util.Objects;
import java.util.Scanner;
import java.math.BigInteger;
public class Fibonacci_Sequence {
static void range() {
Scanner scanner = new Scanner(System.in);
System.out.print("Up to what Position should the Sequence be calculated: ");
int size = scanner.nextInt();
BigInteger[] Sequence = new BigInteger[size];
@h0059ebp
h0059ebp / RAS_Encryption.java
Last active July 4, 2023 20:28
This code shows the RSA-Enryption Algorithm and lets you encode text and gives you back your original Message so its just for demonstration and not real-life application.
import java.math.BigInteger;
import java.util.Scanner;
class RAS_Encryption_Key {
public static void main(String[]args) {
int Position = 0; // Used for defining a position in an Array
int prime0; // Becomes a random prime number
int prime1; // Becomes a random prime number