Are there useful applications for the differences between the one-digits of (2^n) - (n^2), where n is a positive integer? 2 can be a different integer

34 Views Asked by At

I got curious and started listing the differences between 2^n and n^2. For example, 2^6 = 64, and 6^2 = 36, so the difference is 28. I wanted to see if any relationship could be found and I saw that the difference increases A LOT with n (except when n = 1,2, or 3).

Then I wrote a Python code and if you look specifically at the difference of the one-digits (eg. for 64 and 36, that difference is -2) there's a pattern that repeats with every 20 values of n.

And with the one-digit of the difference (eg. for 64 and 36, that would be 8, since 64 - 36 =28), there's also a pattern that repeats with every 20 values of n (starting with n = 4).

Here is the Python code (I'm VERY new to coding so this doesn't actually identify the pattern on its own, it just gives you the values for the problems.):

    r = range(1 , 102)
for n in r:
   exponentiated = 2**n
   powered = n**2
   difference = (exponentiated - powered)
   print("n="+str(n) + " DIFFERENCEof1DIGITS=  " + str(int(str(exponentiated)[-1]) - int(str(powered)[-1])) + "            1DIGITofDIFFERENCE=  " + str(difference)[-1])

Here is a Desmos graph of the difference of the one-digits after I manually inputted the first 45 x-values (with x being n). As you can see, it repeats itself after x=20. https://i.stack.imgur.com/au1e5.png

And here's a similarly made graph with the one-digits of the differences. The y-coordinates from x=4 to x=23 repeat starting with x=24. https://i.stack.imgur.com/luwJa.png

Plus, I did this again but with 3^n and n^3 and found something similar of the graphs repeating after 20 values for n.

Here is the Python code:

r = range(1 , 101)
for n in r:
   exponentiated = 3**n
   powered = n**3
   difference = (exponentiated - powered)
   print("n=" + str(n) + "  DIFFERENCEof1DIGITS=  " + str(int(str(exponentiated)[-1]) - int(str(powered)[-1])) + "       1DIGITofDIFFERENCE=  " + str(difference)[-1])

Here is the graph of the difference of the one-digits: https://i.stack.imgur.com/Kd0Fn.png

And here is the graph of the one-digit of the difference: https://i.stack.imgur.com/7mE0H.png

I think there are also repeating patterns if instead of 2 or 3 you use 4, and so on.

(Sorry if I made that all overly redundant or confusing.)

I haven't seen anyone point out these patterns with differences and 1-digits of a^n and n^a ("a" was 2 and 3 respectively in what I showed) so is there any useful application that can be done with these differences?

And is there a mathematical way to write the graphs for them, without just inputting the values? (or would it be considered a breakthrough if someone found a way)?