Dream, Think, Design , Build and Share Open Source Hardware Software and Ideas

Arduino ile 2^128 hesaplayan yazılımı ChatGPT ile beraber yazdık

// Define the number of digits required to store the result
#define NUM_DIGITS 40
void setup() {
Serial.begin(9600);
// Define the array to store the result
int result[NUM_DIGITS] = {0};
// Set the first digit to 1
result[0] = 1;
// Calculate 2^128 iteratively
for (int i = 0; i < 128; i++) {
int carry = 0;
// Multiply each digit of the result by 2 and add the carry from the previous digit
for (int j = 0; j = 0; i--) {
Serial.print(result[i]);
}
}
void loop() {
// Nothing to do here
}