login

Year-end appeal: Please make a donation to the OEIS Foundation to support ongoing development and maintenance of the OEIS. We are now in our 61st year, we have over 378,000 sequences, and we’ve reached 11,000 citations (which often say “discovered thanks to the OEIS”).

A293703
a(n) is the length of the longest palindromic subsequence in the first differences of the list of the first n negative and positive roots of floor(tan(k))=1.
6
1, 3, 5, 7, 9, 11, 13, 15, 15, 17, 17, 19, 19, 21, 21, 23, 23, 25, 27, 29, 31, 33, 35, 37, 39, 41, 43, 45, 47, 49, 51, 53, 55, 57, 59, 61, 63, 65, 67, 69, 71, 73, 75, 77, 79, 81, 83, 85, 87, 89, 91, 93, 95, 97, 99, 101, 103, 105, 107, 109, 111, 113, 115, 117
OFFSET
1,2
COMMENTS
-A293751 are the negative roots of floor(tan(k))=1.
Each increment of n increases the length of the sequence of the first differences by two, whereby the length of the palindrome increases by 0, 1 or 2.
EXAMPLE
For n = 1, the roots are -18, 1; the first differences are 19; the longest palindrome is 19; so a(n) = 1.
For n = 2, the roots are -21, -18, 1, 4; the first differences are 3, 19, 3; the longest palindrome is 3, 19, 3; so a(n) = 3.
For n = 8, the roots are -87, -84, -65, -62, -43, -40, -21, -18, 1, 4, 23, 26, 45, 48, 67, 70; the first differences are 3, 19, 3, 19, 3, 19, 3, 19, 3, 19, 3, 19, 3, 19, 3; the longest palindrome is 3, 19, 3, 19, 3, 19, 3, 19, 3, 19, 3, 19, 3, 19, 3; so a(n) = 15.
For n = 9, the roots are -90, -87, -84, -65, -62, -43, -40, -21, -18, 1, 4, 23, 26, 45, 48, 67, 70, 89; first differences are 16, 3, 19, 3, 19, 3, 19, 3, 19, 3, 19, 3, 19, 3, 19, 3, 19; the longest palindrome is 3, 19, 3, 19, 3, 19, 3, 19, 3, 19, 3, 19, 3, 19, 3; so a(n) = 15.
MATHEMATICA
rootsA = {}; Do[
If[Floor[Tan[i]] == 1, AppendTo[rootsA, i]], {i, -10^5, 10^5}]
lenN = Length[Select[rootsA, # < 0 &]]
r = 200; roots = rootsA[[lenN - r ;; lenN + r + 1]]
diff = Differences[roots]
center = (Length[diff] + 1)/2; kmax = (Length[diff] + 1)/2 -
1; pals = {}; lenpals = {}; lenpal = 1;
Do[diffk = diff[[center - k ;; center + k]];
lendiffk = Length[diffk]; w = 3;
lenpal = lenpal + 2; (Label[alku]; w = w - 1;
pmax = lendiffk - lenpal - (w - 1);
t = Table[diffk[[p ;; lenpal + w + p - 1]], {p, 1, pmax}];
s = Select[t, # == Reverse[#] &]; If[s != {}, Goto[end], Goto[alku]];
Label[end]); AppendTo[pals, First[s]];
AppendTo[lenpals, Length[Flatten[First[s]]]];
lenpal = Length[Flatten[First[s]]], {k, 0, kmax}]
lenpals (*a[n]=lenpals[[n]]*)
KEYWORD
nonn
AUTHOR
V.J. Pohjola, Oct 20 2017
STATUS
approved