cp's OEIS Frontend

This is a front-end for the Online Encyclopedia of Integer Sequences, made by Christian Perfect. The idea is to provide OEIS entries in non-ancient HTML, and then to think about how they're presented visually. The source code is on GitHub.

A293705 a(n) is the shift of the longest palindromic subsequence in the first n terms of A293699.

This page as a plain text file.
%I A293705 #20 Feb 24 2018 03:11:22
%S A293705 0,-1,0,-1,0,-1,0,-1,-2,-3,-4,-5,-6,6,5,7,6,5,7,6,5,4,3,2,1,0,-1,-2,
%T A293705 -3,-4,-5,-6,-7,-8,-9,-10,-11,-12,-13,-14,-15,-16,-17,-18,18,17,16,15,
%U A293705 14,13,12,11,10,9,8,7,6,5,4,3,2,1,0,-1,-2,-3,-4,-5
%N A293705 a(n) is the shift of the longest palindromic subsequence in the first n terms of A293699.
%C A293705 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. When shift is a positive number, it indicates the number of steps that the palindrome has moved to the right from its symmetric position.
%H A293705 V.J. Pohjola, <a href="/A293705/b293705.txt">Table of n, a(n) for n = 1..10000</a>
%H A293705 V.J. Pohjola, <a href="https://palindromesdotblog.files.wordpress.com/2018/02/shiftn-1-10000-a293705.pdf">Line plot for n=1...10000</a>
%H A293705 V.J. Pohjola, <a href="https://palindromesdotblog.files.wordpress.com/2018/02/shiftn-1-100-293705.pdf">Line plot for n=1...100</a>
%e A293705 For n = 1, differences = 3; longest palindrome = 3; a(1) = 0 - 0 = 0.
%e A293705 For n = 2, differences = 3, 19; longest palindrome = 3; a(2) = 0 - 1 = -1.
%e A293705 For n = 14, differences = 3, 19, 3, 19, 3, 19, 3, 3, 16, 3, 3, 16, 3, 3; longest palindrome = 3, 3, 16, 3, 3, 16, 3, 3; a(14) = 6 - 0 = 6.
%t A293705 rootsn = Flatten[Position[Table[Floor[Tan[-i]], {i, 1, 10^4}], 1]];
%t A293705 difn = Differences[rootsn];
%t A293705 ldn = Length[difn];
%t A293705 kmax = 500; palsn = {}; lenpalsn = {0}; shiftn = {}; posn = {};
%t A293705 Do[diffin = difn[[1 ;; k]]; lendiffin = Length[diffin];
%t A293705   pmax = k - Last[lenpalsn];
%t A293705   t = Table[difn[[p ;; k]], {p, 1, pmax}];
%t A293705   sn = Flatten[Select[t, # == Reverse[#] &]];
%t A293705   If[sn == {},
%t A293705    AppendTo[palsn, Last[palsn]] && AppendTo[lenpalsn, Last[lenpalsn]],
%t A293705    AppendTo[palsn, sn] && AppendTo[lenpalsn, Length[Flatten[sn]]]];
%t A293705   AppendTo[posn, Position[t, Last[palsn]]]; pp = Last[Flatten[posn]] - 1;
%t A293705   qq = lendiffin - (pp + Last[lenpalsn]);
%t A293705   AppendTo[shiftn, pp - qq], {k, 1, kmax}];
%t A293705 shiftn (*a(n)=shiftn[[n]]*)
%Y A293705 Cf. A293698, A293751, A293700, A293702, A293704, A293699, A293701, A293706, A293703.
%K A293705 sign
%O A293705 1,9
%A A293705 _V.J. Pohjola_, Oct 21 2017