cp's OEIS Frontend

This is a front-end for the Online Encyclopedia of Integer Sequences, made by Christian Perfect. The idea is to provide OEIS entries in non-ancient HTML, and then to think about how they're presented visually. The source code is on GitHub.

A293705 a(n) is the shift of the longest palindromic subsequence in the first n terms of A293699.

Original entry on oeis.org

0, -1, 0, -1, 0, -1, 0, -1, -2, -3, -4, -5, -6, 6, 5, 7, 6, 5, 7, 6, 5, 4, 3, 2, 1, 0, -1, -2, -3, -4, -5, -6, -7, -8, -9, -10, -11, -12, -13, -14, -15, -16, -17, -18, 18, 17, 16, 15, 14, 13, 12, 11, 10, 9, 8, 7, 6, 5, 4, 3, 2, 1, 0, -1, -2, -3, -4, -5
Offset: 1

Views

Author

V.J. Pohjola, Oct 21 2017

Keywords

Comments

Shift is the measure of the position of the palindromic subsequence within the corresponding sequence of first differences, defined as the number of terms being dropped from the left end of the sequence of first differences minus those dropped from its right end. When shift is a positive number, it indicates the number of steps that the palindrome has moved to the right from its symmetric position.

Examples

			For n = 1, differences = 3; longest palindrome = 3; a(1) = 0 - 0 = 0.
For n = 2, differences = 3, 19; longest palindrome = 3; a(2) = 0 - 1 = -1.
For n = 14, differences = 3, 19, 3, 19, 3, 19, 3, 3, 16, 3, 3, 16, 3, 3; longest palindrome = 3, 3, 16, 3, 3, 16, 3, 3; a(14) = 6 - 0 = 6.
		

Crossrefs

Programs

  • Mathematica
    rootsn = Flatten[Position[Table[Floor[Tan[-i]], {i, 1, 10^4}], 1]];
    difn = Differences[rootsn];
    ldn = Length[difn];
    kmax = 500; palsn = {}; lenpalsn = {0}; shiftn = {}; posn = {};
    Do[diffin = difn[[1 ;; k]]; lendiffin = Length[diffin];
      pmax = k - Last[lenpalsn];
      t = Table[difn[[p ;; k]], {p, 1, pmax}];
      sn = Flatten[Select[t, # == Reverse[#] &]];
      If[sn == {},
       AppendTo[palsn, Last[palsn]] && AppendTo[lenpalsn, Last[lenpalsn]],
       AppendTo[palsn, sn] && AppendTo[lenpalsn, Length[Flatten[sn]]]];
      AppendTo[posn, Position[t, Last[palsn]]]; pp = Last[Flatten[posn]] - 1;
      qq = lendiffin - (pp + Last[lenpalsn]);
      AppendTo[shiftn, pp - qq], {k, 1, kmax}];
    shiftn (*a(n)=shiftn[[n]]*)