5
$\begingroup$

Why does this not work?

FindSequenceFunction[{1/2, (2/3)^2, (3/4)^4, (4/5)^6, (5/6)^8}, n]
(*FindSequenceFunction[{1/2,4/9,81/256,4096/15625,390625/1679616},n]*)

I thought (n/(n + 1))^(2 n - 2) but unfortunately the first number isn't correct. Except the first number, I expect all the following numbers are of the form (n/(n + 1))^(2 n - 2).

$\endgroup$
4
  • 4
    $\begingroup$ Help says attempts to find a simple function that yields the sequence Subscript[a, n] note the word attempts, which means it might not be able to find such a function. May be it needs more terms? May be there is no such function? But I see some weakness in this function, Here is an easier one it could not find f[n_] := (n/(n + 1))^(n); Table[f[n], {n, 1, 10}] and now FindGeneratingFunction[%, n] could not find the function (n/(n + 1))^(n) which generates this sequence. I tried more terms, it still could not find it. $\endgroup$
    – Nasser
    May 29 at 8:06
  • $\begingroup$ @Nasser I see. Is there a better function for this? $\endgroup$
    – emnha
    May 29 at 8:12
  • 3
    $\begingroup$ I do not know of alternative. May be someone will have better idea what is going on and if there is a workaround. $\endgroup$
    – Nasser
    May 29 at 8:24
  • 1
    $\begingroup$ When FindSequenceFuntion fails, the next step is to try oeis.org. That website also deals with fractions that are rational numbers. While it doesn't have that particular sequence (or the one that @Nasser mentioned), one of the hints (oeis.org/hints.html) is to enter the numerators and denominators separately. For these two cases, that gives enough information to find the sequence function. $\endgroup$
    – JimB
    May 29 at 18:39

2 Answers 2

8
$\begingroup$

Consider the sequence given by @Nasser in the comments above:

seq = Table[(n/(n + 1))^(n), {n, 1, 10}]

Sequence

Find the sequences of the numerators and denominators:

numerators = Numerator[seq]
(* {1, 4, 27, 256, 3125, 46656, 823543, 16777216, 387420489, 10000000000} *)
denominators = Denominator[seq]
(* {2, 9, 64, 625, 7776, 117649, 2097152, 43046721, 1000000000, 25937424601} *)

(A hint given at oeis.org is to look at the numerator and denominator sequences separately.)

Use FindSequenceFunction on the numerators:

FindSequenceFunction[numerators, n]
(* n^n *)

Now on the denominators:

FindSequenceFunction[denominators, n]
(* FindSequenceFunction[{2, 9, 64, 625, 7776, 117649, 2097152, 43046721, 1000000000, 25937424601}, n] *)

But just the input is returned. So check this sequence at oeis.org and we find that one of the generators of those numbers is

n^(n-1)

If we produce the first 10 values from that result we see

Table[n^(n - 1), {n, 1, 10}]
(* {1, 2, 9, 64, 625, 7776, 117649, 2097152, 43046721, 1000000000} *)

We need the first term to be 2 rather than 1:

Table[(n + 1)^n, {n, 1, 10}]
(* {2, 9, 64, 625, 7776, 117649, 2097152, 43046721, 1000000000, 25937424601} *)

Now putting the numerator and denominator functions together we have

n^n/(n+1)^n

or

(n/(n+1))^n

which is the formula that generated the sequence.

For the OP's original problem FindSequenceFunction doesn't work and for the denominator the first term doesn't "fit". However, skipping the first term and searching for the numerator and denominator sequences at oeis.org does work and one can then construct a formula for the OP's sequence.

Addition:

If one had many sequences in Mathematica to check at oeis.org, then the following function will at least report "At least one sequence found." or "Sorry, couldn't find sequence." One would still have to go to oeis.org to look at the positive hits.

checkOEIS[sequence_] := Module[{html, string},
  (* Change ", " to "%2C" *)
  string = StringReplace[ToString[sequence], ", " -> "%2C"];
  (* Remove curly brackets *)
  string = StringTake[string, {2, StringLength[string] - 1}];
  (* Get report *)
  html = Import["https://oeis.org/search?q=" <> string <>  "&language=english&go=Search"];
  (* If "Sorry" is in the received text, then there is no corresponding sequence found *)
  If[StringPosition[html, "Sorry, but the terms"] == List[], 
   Print["At least one sequence found."], 
   Print["Sorry, couldn't find sequence."]]
  ]

checkOEIS[{1, 2, 3, 4}]
(* At least one sequence found. *)
$\endgroup$
6
  • $\begingroup$ FindSequenceFunction[Table[n^(2 n - 2), {n, 1, 12}], n] returns the input. $\endgroup$
    – user64494
    May 30 at 5:26
  • $\begingroup$ @user64494 oeis.org does find the generating function for that sequence. $\endgroup$
    – JimB
    May 30 at 6:12
  • $\begingroup$ JimB (@ does not work.): Sorry, OEIS is not a Mathematica tool. $\endgroup$
    – user64494
    May 30 at 6:16
  • $\begingroup$ @user64494 Yes but one piece of software doesn't do everything (although Mathematica can certainly do a lot). A valid solution to any question posed at this forum might very well include calls to R, the operating system, etc. What I proposed did use Mathematica for half of the solution. Had I only used oeis.org, then my answer would have been better as a comment and I would agree with your assessment. $\endgroup$
    – JimB
    May 30 at 6:32
  • $\begingroup$ JimB: Mathematica may execute C++ and R codes, but can't programmatically find and extract sequences from OEIS. $\endgroup$
    – user64494
    May 30 at 11:04
4
$\begingroup$
seq = {1/2, (2/3)^2, (3/4)^4, (4/5)^6, (5/6)^8};

As you point out, the powers are not easily represented and FindSequenceFunction is not able to handle this case without help. The sequence is

x[n_] = (n/(n + 1))^FindSequenceFunction[{1, 2, 4, 6, 8, 10}, n]

enter image description here

% // InputForm

(* (n/(1 + n))^DifferenceRoot[Function[{\[FormalY], \[FormalN]}, 
    {-2 - \[FormalY][\[FormalN]] + \[FormalY][1 + \[FormalN]] == 0, 
     \[FormalY][1] == 1, \[FormalY][2] == 2}]][n] *)

Table[x[n], {n, Length[seq]}] === seq

(* True )
$\endgroup$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.