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!)
A293704 a(n) is the shift of the longest palindromic subsequence in the first n terms of A293700. 10

%I #32 Feb 24 2018 03:06:03

%S 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,

%T -10,-11,-12,-13,-14,14,13,12,11,10,9,8,7,6,5,4,3,2,1,0,-1,-2,-3,-4,

%U -5,-6,-7,-8,-9,-10,-11,-12,-13,-14,-15,-16,-17,-18,18,17,16

%N a(n) is the shift of the longest palindromic subsequence in the first n terms of A293700.

%C 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.

%H V.J. Pohjola, <a href="/A293704/b293704.txt">Table of n, a(n) for n = 1..10000</a>

%H V. J. Pohjola, <a href="https://palindromesdotblog.files.wordpress.com/2018/01/shiftp-1-150.pdf">Line plot drawn for n=1...150</a>

%H V. J. Pohjola, <a href="https://palindromesdotblog.files.wordpress.com/2017/12/shiftp-1-2500.pdf">Line plot drawn for n=1...2500</a>

%H V. J. Pohjola, <a href="https://palindromesdotblog.files.wordpress.com/2017/12/shiftp-1-10000.pdf">Line plot drawn for n=1...10000</a>

%e For n = 1, first differences = 3; longest palindrome = 3; a(1) = 0 - 0 = 0.

%e For n = 2, differences = 3, 19; longest palindrome = 3; a(2) = 0 - 1 = -1.

%e 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.

%t rootsp = Flatten[Position[Table[Floor[Tan[i]], {i, 1, 10^4}], 1]];

%t lrootsp = Length[rootsp];

%t difp = Differences[rootsp];

%t ldp = Length[difp];

%t kmax = 500; palsp = {}; lenpalsp = {0}; shiftp = {}; posp = {};

%t Do[diffip = difp[[1 ;; k]]; lendiffip = Length[diffip];

%t pmax = k - Last[lenpalsp];

%t t = Table[difp[[p ;; k]], {p, 1, pmax}];

%t sp = Flatten[Select[t, # == Reverse[#] &]];

%t If[sp == {},

%t AppendTo[palsp, Last[palsp]] && AppendTo[lenpalsp, Last[lenpalsp]],

%t AppendTo[palsp, sp] && AppendTo[lenpalsp, Length[Flatten[sp]]]];

%t AppendTo[posp, Position[t, Last[palsp]]]; pp = Last[Flatten[posp]] - 1;

%t qq = lendiffip - (pp + Last[lenpalsp]);

%t AppendTo[shiftp, pp - qq], {k, 1, kmax}];

%t lenpalsp;

%t shiftp (*a(n)=shiftp[[n]]*)

%Y Cf. A293698, A293751, A293700, A293701, A293705, A293699, A293702, A293706, A293703.

%K sign

%O 1,19

%A _V.J. Pohjola_, Oct 21 2017

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 August 21 03:35 EDT 2024. Contains 375342 sequences. (Running on oeis4.)