|
|
A293704
|
|
a(n) is the shift of the longest palindromic subsequence in the first n terms of A293700.
|
|
10
|
|
|
0, -1, 0, -1, 0, -1, 0, -1, 0, -1, 0, -1, 0, -1, 0, -1, 0, -1, -2, -3, -4, -5, -6, -7, -8, -9, -10, -11, -12, -13, -14, 14, 13, 12, 11, 10, 9, 8, 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
(list;
graph;
refs;
listen;
history;
text;
internal format)
|
|
|
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
|
|
|
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
|
|
|
STATUS
|
approved
|
|
|
|