Storing huge numbers in an array?

Hi all!

So this kind of a noob question so bear with me!

I’m trying to store a few really large numbers in an array to make a lookup table but I’m not really sure how to go about this.

If anybody could shed some light on this id greatly appreciate it!

The code below is just an example of what I want to do!

int rnd = random(5);

while(1){


PROGMEM const uint32_t List[5]{

1045865555339,
841913659661,
354384343,
7778584153263,
100000251545

};



Serial.println(List[rnd]);


}

Have a look at the Progmem reference

7778584153263 doesn't fit into 32 bits

Juraj:
7778584153263 doesn't fit into 32 bits

I tried using a 64bit data typ but i think i reached the stack limit and couldnt get it to print at all.

What exactly are these huge "magic" numbers and what are they used for ?

UNI-T:
I tried using a 64bit data typ but i think i reached the stack limit and couldnt get it to print at all.

"stack limit"?

You can't simply print 64 bit variables, but comparisons and arithmetic should work fine.

UNI-T:
I tried using a 64bit data typ but i think i reached the stack limit and couldnt get it to print at all.

I have used the uint64_t data type in Arduino without issue. Supply a potentially working (compiles) example of what you did for us to check.

Here is the routine that I used...

void dec2bin64(uint64_t myNum, byte NumberOfBits) {
  if (NumberOfBits <= 64){
    myNum = myNum << (64 - NumberOfBits);
    for (byte i = 0; i < NumberOfBits; i++) {
      if (bitRead(myNum,63 - i) == 1) 
      Serial.print("1");
      else 
      Serial.print("0");
    }
    Serial.println();
  }
}

For really, really large numbers, consider the BigNumber library; does math and prints too!