OFFSET
1,19
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. Thus, when shift is negative, the palindrome has moved leftward from its symmetric position.
LINKS
V.J. Pohjola, Table of n, a(n) for n = 1..10000
V. J. Pohjola, Line plot drawn for n=1...150
V. J. Pohjola, Line plot drawn for n=1...2500
V. J. Pohjola, Line plot drawn for n=1...10000
EXAMPLE
For n = 1, first 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 = 22, differences = 3, 19, 3, 19, 3, 19, 3, 19, 3, 19, 3, 19, 3, 19, 3, 19, 3, 3, 16, 3, 3, 16; longest palindrome = 3, 19, 3, 19, 3, 19, 3, 19, 3, 19, 3, 19, 3, 19, 3, 19, 3; a(22) = 0 - 5 = -5.
MATHEMATICA
rootsp = Flatten[Position[Table[Floor[Tan[i]], {i, 1, 10^4}], 1]];
lrootsp = Length[rootsp];
difp = Differences[rootsp];
ldp = Length[difp];
kmax = 500; palsp = {}; lenpalsp = {0}; shiftp = {}; posp = {};
Do[diffip = difp[[1 ;; k]]; lendiffip = Length[diffip];
pmax = k - Last[lenpalsp];
t = Table[difp[[p ;; k]], {p, 1, pmax}];
sp = Flatten[Select[t, # == Reverse[#] &]];
If[sp == {},
AppendTo[palsp, Last[palsp]] && AppendTo[lenpalsp, Last[lenpalsp]],
AppendTo[palsp, sp] && AppendTo[lenpalsp, Length[Flatten[sp]]]];
AppendTo[posp, Position[t, Last[palsp]]]; pp = Last[Flatten[posp]] - 1;
qq = lendiffip - (pp + Last[lenpalsp]);
AppendTo[shiftp, pp - qq], {k, 1, kmax}];
lenpalsp;
shiftp (*a(n)=shiftp[[n]]*)
CROSSREFS
KEYWORD
sign
AUTHOR
V.J. Pohjola, Oct 21 2017
STATUS
approved