Why there is this kind of relation between power and factorial? I know that there is a way to use this pattern to generate powers using just addition and one factorial, but I can't wrap my puny brain around it above the fourth power. Is there any way to write a generalised algorithm for this kind of thing? Please answer in pseudocode, because I am looking for a mathematical answer, not a programming one. Here is an example program written in python (by me) exclusive to the third power:
print('This program will print cube numbers without using multiplication.')
max = input('What is the highest number you want to be cubed? Please type u if you want unlimited cubes. ')
a = 1
b = 7
c = 12
i = 1
if max == 'u':
while True:
print(i,'cubed is',a)
a += b
b += c
c += 6
i += 1
else:
max = int(max)
for i in range(max):
print(i+1,'cubed is',a)
a += b
b += c
c += 6
I know that lists may have to be used, or an umlimited amount of variables.