简体   繁体   English

序列中的下一个数字 || 一般的做法

[英]Next number in the sequence || General approach

how can I find the next number in this sequence,我怎样才能找到这个序列中的下一个数字,

1, 4, 7, 8, 13, 12, 9, ?

How to check, given any sequence of numbers, feasible or not.如何检查,给定任何数字序列,是否可行。 Any general theory or approach is very much welcomed.任何一般的理论或方法都非常受欢迎。

One method is to go to the Online Encyclopedia of Integer Sequences and enter your list of at least six or eight numbers into the box and see if that happens to be a known sequence.一种方法是 go 到Integer 序列的在线百科全书,然后在框中输入至少六个或八个数字的列表,看看这是否恰好是一个已知的序列。 For your example this doesn't find a known sequence.对于您的示例,这找不到已知序列。

If that doesn't work then you can try Mathematica's FindFormula如果这不起作用,那么您可以尝试 Mathematica 的FindFormula

p=FindFormula[{1, 4, 7, 8, 13, 12, 9}];

and then接着

p[1] returns 1, p[2] returns 4, p[3] returns 7... and p[8] returns 106, etc.

You can read the documentation on FindFormula and you can look at the formula p by using InputForm[p] where #1 represents a variable in the function p.您可以阅读有关FindFormula的文档,也可以使用InputForm[p]查看公式 p,其中#1表示 function p 中的一个变量。

In general I think this is rarely going to produce the result that you are looking for.一般来说,我认为这很少会产生您正在寻找的结果。

seq = FindSequenceFunction[{1, 4, 7, 8, 13, 12, 9}, n]

(48 - 74 n - 14 n^2 + 11 n^3 - n^4)/(3 (-13 + 3 n)) (48 - 74 n - 14 n^2 + 11 n^3 - n^4)/(3 (-13 + 3 n))

Checking the 7th number检查第 7 个数字

n = 7;
seq

9 9

The next number is a fraction, apparently下一个数字显然是分数

n = 8;
seq

32/11 32/11

Show[Plot[seq, {n, 1, 10}],
 ListPlot[Table[seq, {n, 1, 10}]],
 PlotRange -> {{0, 10}, {-20, 30}}, AxesOrigin -> {0, 0}]

在此处输入图像描述

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM