login
The OEIS is supported by the many generous donors to the OEIS Foundation.

 

Logo
Hints
(Greetings from The On-Line Encyclopedia of Integer Sequences!)
A293702 a(n) is the length of the longest palindromic subsequence in the first n terms of A293751. 11
1, 1, 3, 3, 5, 5, 7, 7, 7, 7, 7, 7, 7, 8, 8, 9, 11, 11, 12, 14, 16, 18, 20, 22, 24, 26, 26, 26, 26, 26, 26, 26, 26, 26, 26, 26, 26, 26, 26, 26, 26, 26, 26, 26, 27, 29, 31, 33, 35, 37, 39, 41, 43, 45, 47, 49, 51, 53, 55, 57, 59, 61, 63, 63, 63, 63, 63, 63, 63, 63 (list; graph; refs; listen; history; text; internal format)
OFFSET
1,3
LINKS
EXAMPLE
For n = 1, Roots = 18, 21; First differences = 3; Longest palindrome = 3; a(n) = 1.
For n = 2, Roots = 18, 21, 40; First differences = 3, 19; Longest palindrome = 3; a(n) = 1.
For n = 3, Roots = 18, 21, 40, 43; First differences = 3, 19, 3; Longest palindrome = 3, 19, 3; a(n) = 3.
For n = 20, Roots = 18, 21, 40, 43, 62, 65, 84, 87, 90, 106, 109, 112, 128, 131,134, 150, 153, 156, 172, 175; First differences = 3, 19, 3, 19, 3, 19, 3, 3, 16, 3, 3, 16, 3, 3, 16, 3, 3, 16, 3, 3; Longest palindrome = 3, 3, 16, 3, 3, 16, 3, 3, 16, 3, 3, 16, 3, 3; a(n) = 14.
MATHEMATICA
rootsn = Flatten[Position[Table[Floor[Tan[-i]], {i, 1, 10^4}], 1]];
difn = Differences[rootsn];
imax = 100; palsn = {}; lenpalsn = {0};
Do[diffin = difn[[1 ;; i]]; lendiffin = Length[diffin];
pmax = i - Last[lenpalsn];
t = Table[difn[[p ;; i]], {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]]]], {i, 1, imax}];
Drop[lenpalsn, 1] (* a(n)=Drop[lenpalsn, 1][[n]] *)
CROSSREFS
Sequence in context: A335568 A085779 A078936 * A061794 A088524 A129337
KEYWORD
nonn
AUTHOR
V.J. Pohjola, Oct 16 2017
STATUS
approved

Lookup | Welcome | Wiki | Register | Music | Plot 2 | Demos | Index | Browse | More | WebCam
Contribute new seq. or comment | Format | Style Sheet | Transforms | Superseeker | Recents
The OEIS Community | Maintained by The OEIS Foundation Inc.

License Agreements, Terms of Use, Privacy Policy. .

Last modified April 18 16:22 EDT 2024. Contains 371780 sequences. (Running on oeis4.)