What are some algorithms for finding a closed form function given an integer sequence?

后端 未结 7 961
刺人心
刺人心 2020-12-30 14:58

I\'m looking form a programatic way to take an integer sequence and spit out a closed form function. Something like:

Given: 1,3,6,10,15

Return: n(n+1)/2

7条回答
  •  醉梦人生
    2020-12-30 15:12

    I think your problem is ill-posed. Given any finite number of integers in a sequence with no generating function, the next element can be anything.

    You need to assume something about the sequence. Is it geometric? Arithmetic?

提交回复
热议问题