I'd like to save a number in the flash memory (or any other) to be able to consultate it later in my pc, even if the arduino shutted off. I have read about eeprom memory, but I think it doesn't work for me because I read that it has a limited use and I will be changing the number to be saved every 3 seconds and I will be changing it at least 1.000.000 times.
Well, it is empirically known that EEPROM has an overwhelmingly longer life than shown in datasheets...
Probably withstands 1 million rewrites, some verification results have withstood 10 million rewrites.
If you are interested, please googling with "eeprom durability test".
Since this is the result of 1 byte cell, further extension of life can be expected by circulating the address.
This is a technique called "wear leveling" that is also used in SSD.
The memory cell damage caused by rewriting is distributed and averaged in each cell.
For example, if the data to be stored in a 1KB EEPROM with a life of 100,000 writes per cell is 10 bytes, 100 times the life (that is, 10 million times) can be expected by the above method.
If you still want more rewrites, you'll need to use battery backup RAM devices.
Leaving aside that the contemplated update rate is likely more than is safely supported by EEPROM, the EEPROM can be read out on the PC using AVRDUDE. I found this example:
If you write sequentially to the EEPROM as a ring buffer, you can avoid rewriting just one location over and over and extend the lifetime of your EEPROM.
The number of writes to the 14th power of 10 per cell.
It has a lifespan of 3,168,809 years from cell rewrite per second without wear leveling.
So crazy...
And, writing time that can be said to be a moment for Arduino.
Data transfer is the only bottleneck, it can be used like RAM.
Still, it's non-volatile memory! The data remains almost forever!
Perhaps revise your code so that you don't have to write different values to the same EEPROM location so many times. Frankly, I have never made a project that would realistically bring this requirement. There is always a way around it.
A first start is of course to use update() instead of write(), but there are other tricks to think of depending on the application.
So perhaps take a step back and let's determine what you try to achieve?