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.

Showing 1-10 of 11 results. Next

A293700 First differences of A293698.

Original entry on oeis.org

3, 19, 3, 19, 3, 19, 3, 19, 3, 19, 3, 19, 3, 19, 3, 19, 3, 3, 16, 3, 3, 16, 3, 3, 16, 3, 3, 16, 3, 3, 19, 3, 19, 3, 19, 3, 19, 3, 19, 3, 19, 3, 19, 3, 19, 3, 19, 3, 19, 3, 19, 3, 19, 3, 3, 16, 3, 3, 16, 3, 3, 16, 3, 3, 16, 3, 3, 19, 3, 19, 3, 19, 3, 19, 3, 19, 3
Offset: 1

Views

Author

V.J. Pohjola, Oct 16 2017

Keywords

Comments

Sequence seems to be composed of only three different integers: 3, 16 and 19.
Despite its apparent simplicity, it has interesting palindromic and periodic features and may be conjectured not to be represented in a closed form.
It has a resemblance to the sequences in DNA being composed of four nucleotide bases in varying orders. These sequences, too, contain palindromic substructures having an important role for the genome.
From Robert Israel, Nov 06 2017: (Start)
The only possible values are 3, 16 and 19.
k is in A293698 iff Pi/4 <= k - m*Pi < arctan(2) for some m. We may then verify the following:
If Pi/4 <= k - m*Pi < arctan(2) - 16 + 5*Pi, then k+16 is the next term of A293698.
If arctan(2) - 16 + 5*Pi <= k - m*Pi < 5*Pi/4 - 3, then k+19 is the next term of A293698.
If 5*Pi/4 - 3 <= k - m*Pi < arctan(2), then k+3 is the next term of A293698. (End)

Crossrefs

Programs

  • Maple
    A293698:= select(i -> floor(tan(i))=1, [$1..1000]):
    A293698[2..-1]-A293698[1..-2]; # Robert Israel, Nov 06 2017
  • Mathematica
    rootsp = Flatten[Position[Table[Floor[Tan[i]], {i, 1, 10^6}], 1]];
    difp = Differences[rootsp]
    (*a(n)=difp[[n]]*)
    Differences@ Select[ Range@750, Floor@ Tan@# == 1 &] (* Robert G. Wilson v, Nov 06 2017 *)
  • PARI
    lista(nn) = {last = 0; for (n=1, nn, if (floor(tan(n)) == 1, if (last, print1(n-last, ", ")); last = n;););} \\ Michel Marcus, Oct 24 2017

A295285 Numbers n such that for positive integers i, the union of sequences n+22i contains the positive roots of floor(tan(k)) = 1 (A293698).

Original entry on oeis.org

1, 4, 183, 538, 893, 1248, 1603, 1958, 2313, 2668, 3023, 3378, 3733, 4088, 4443, 4798, 5153, 5508, 5863, 6218, 6573, 6928, 225919, 226274, 226629, 226984, 227339, 227694, 228049, 228404, 228759, 229114, 229469, 229824
Offset: 1

Views

Author

V.J. Pohjola, Nov 19 2017

Keywords

Comments

Each number n is the first term of the corresponding individual sequence n+22i, and the whole is union of these overlapping sequences. Due to periodicity, there is a single generating function (n-(n-22)*j)/(j-1)^2 for the sequences. However, the function does not provide predictive means for generating A293698, because also terms which are not the roots are generated. The roots appear in each n+22i as finite subsequences of given length, at given steps. There is, however slight but difficult or impossible to predict variability both in the length, which is either 37 or 36, and the step which is either 7810 or 7832. A293698 is union of these subsequences. - V.J. Pohjola, Feb 25 2018

Examples

			For n = 1, i = 0..12, the terms 1, 23, 45, .., 265 are the roots.
For n = 4, i = 0..28, the terms 4, 26, 48, .., 620 are the roots.
For n = 183, i = 0..36, the terms 183, 205, 227, .., 975 are the roots.
For n = 1, i = 331..367, the terms 7283, 7305, 7327, .., 8075 are the roots.
For n = 4, i = 347..383, the terms 7638, 7660, 7682, .., 8430 are the roots.
For n = 183, i = 355..391, the terms 7993, 8015, 8037, .., 8785 are the roots.
The subsequences have the length of either 36 or 37 beyond the initial ranges 1+22i and 4+22i which are 13 and 29, respectively.
		

Crossrefs

Programs

  • Mathematica
    posroots6 = {}; Do[If[Floor[Tan[n]] == 1, AppendTo[posroots6, n]], {n, 0, 10^6}]
    bigroots = {1}; posrootsi = {{1}}; Do[jj = {};
    Do[lastb = Last[bigroots];
    If[MemberQ[posroots6, lastb + 22*j], AppendTo[jj, j]], {j, 0, 10^4}];
    posrootsi = Flatten[AppendTo[posrootsi, Table[lastb + 22*jj[[k]], {k, 1, Length[jj]}]]];
    bigroot = First[Complement[posroots6, posrootsi]];
    AppendTo[bigroots, bigroot], {i, 1, 100}]; bigroots

Extensions

Name edited by V.J. Pohjola, Mar 15 2018

A293701 a(n) is the length of the longest palindromic subsequence in the first n terms of A293700.

Original entry on oeis.org

1, 1, 3, 3, 5, 5, 7, 7, 9, 9, 11, 11, 13, 13, 15, 15, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 18, 20, 22, 24, 26, 28, 30, 32, 34, 36, 38, 40, 42, 44, 46, 46, 46, 46, 46, 46, 46, 46, 46, 46, 46, 46, 46, 46, 46, 46, 46, 46, 46, 47, 49
Offset: 1

Views

Author

V.J. Pohjola, Oct 16 2017

Keywords

Comments

If a(n + 1) > a(n) for some n, then A293700(n + 1) is in the longest palindrome. So to find a(n + 1) it suffices to check if A293700 is in the palindrome, which must be at least of length a(n). - David A. Corneth, Nov 25 2017
At points where a(n) = n, the whole sequence is a palindrome. For example at n=9105, the length of the longest palindrome a(9105) is 9105 (see A294923).

Examples

			For n = 1, roots = 1, 4; first differences = 3; longest palindrome = 3; a(n) = 1.
For n = 2, roots = 1, 4, 23; first differences = 3, 19; longest palindrome = 3; a(n) = 1.
For n = 3, roots = 1, 4, 23, 26; first differences = 3, 19, 3; longest palindrome = 3, 19, 3; a(n) = 3.
For n = 33, roots = 1, 4, 23, 26, 45, 48, 67, 70, 89, 92, 111, 114, 133, 136, 155, 158, 177, 180, 183, 199, 202, 205, 221, 224, 227, 243, 246, 249, 265, 268, 271, 290, 293, 312; first differences = 3, 19, 3, 19, 3, 19, 3, 19, 3, 19, 3, 19, 3, 19, 3, 19, 3, 3, 16, 3, 3, 16, 3, 3, 16, 3, 3, 16, 3, 3, 19, 3, 19; longest palindrome = 19, 3, 19, 3, 3, 16, 3, 3, 16, 3, 3, 16, 3, 3, 16, 3, 3, 19, 3, 19; a(n) = 20.
		

Crossrefs

Programs

  • Mathematica
    rootsp = Flatten[Position[Table[Floor[Tan[i]], {i, 1, 10^4}], 1]];
    lrootsp = Length[rootsp];
    difp = Differences[rootsp];
    ldp = Length[difp];
    nmax = 200; palsp = {}; lenpalsp = {0};
    Do[diffip = difp[[1 ;; n]]; lendiffip = Length[diffip];
      pmax = n - Last[lenpalsp];
      t = Table[difp[[p ;; n]], {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]]]], {n, 1, nmax}];
    Drop[lenpalsp,1](*a(n)=Drop[lenpalsp,1][[n]]*)
  • PARI
    firstsols(n) = {my(res = vector(n), i = 0, pi = [Pi, Pi], sols = [atan(1), atan(2)]); while(1, for(j = ceil(sols[1]), floor(sols[2]), i++; if(i>n, return(res)); res[i] = j); sols+=[Pi(), Pi()])} \\ A293698
    diff(v) = vector(#v-1,i,v[i+1]-v[i]);
    first(n) = {my(res = vector(n), m = 0, check = diff(firstsols(n+1))); for(i=1, n, for(j = 1, i - m, if(ispalindrome(check, j, i), m = i - j + 1; next(1))); res[i] = m); res}
    ispalindrome(v, {llim = 1}, {ulim = #v}) = {for(i=0, (ulim - llim) \ 2, if(v[llim + i]!=v[ulim - i], return(0))); 1} \\ David A. Corneth, Nov 25 2017
    
  • Scheme
    ;; This uses memoization-macro definec and assumes also that A293700 is available:
    (definec (A293701 n) (if (= 1 n) n (let outloop ((k n)) (cond ((<= k (A293701 (- n 1))) (A293701 (- n 1))) (else (let inloop ((i n)) (let ((low-ind (+ 1 (- n k) (- n i)))) (cond ((< i low-ind) (max k (A293701 (- n 1)))) ((not (= (A293700 i) (A293700 low-ind))) (outloop (- k 1))) (else (inloop (- i 1)))))))))))
    ;; Antti Karttunen, Nov 25 2017

A293702 a(n) is the length of the longest palindromic subsequence in the first n terms of A293751.

Original entry on oeis.org

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
Offset: 1

Views

Author

V.J. Pohjola, Oct 16 2017

Keywords

Examples

			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.
		

Crossrefs

Programs

  • 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]] *)

A293751 Values of positive integer i such that floor(tan(-i)) = 1.

Original entry on oeis.org

18, 21, 40, 43, 62, 65, 84, 87, 90, 106, 109, 112, 128, 131, 134, 150, 153, 156, 172, 175, 178, 197, 200, 219, 222, 241, 244, 263, 266, 285, 288, 307, 310, 329, 332, 351, 354, 373, 376, 395, 398, 417, 420, 439, 442, 445, 461, 464, 467, 483, 486, 489, 505, 508, 511, 527, 530, 533, 552, 555, 574, 577, 596
Offset: 1

Views

Author

V.J. Pohjola, Oct 15 2017

Keywords

Crossrefs

Cf. A000530, A293698, A293699, A293702, A293705, A293700, A293701, A293704. a(n) are also the roots of A195910(i)=1, starting from i=1.

Programs

  • Mathematica
    rootsn = Flatten[Position[Table[Floor[Tan[-i]], {i, 1, 10^3}], 1]];
    (*a(n) = rootsn[[n]]*)
    Select[Range@600, Floor@Tan@-# == 1 &] (* Robert G. Wilson v, Nov 19 2017 *)
  • PARI
    isok(n) = floor(tan(-n)) == 1; \\ Michel Marcus, Nov 03 2017

Formula

floor(tan(-n)) = -ceiling(tan(n)).

A293699 First differences of A293751.

Original entry on oeis.org

3, 19, 3, 19, 3, 19, 3, 3, 16, 3, 3, 16, 3, 3, 16, 3, 3, 16, 3, 3, 19, 3, 19, 3, 19, 3, 19, 3, 19, 3, 19, 3, 19, 3, 19, 3, 19, 3, 19, 3, 19, 3, 19, 3, 3, 16, 3, 3, 16, 3, 3, 16, 3, 3, 16, 3, 3, 19, 3, 19, 3, 19, 3, 19, 3, 19, 3, 19, 3, 19, 3, 19, 3, 19, 3, 19, 3, 19, 3
Offset: 1

Views

Author

V.J. Pohjola, Oct 16 2017

Keywords

Comments

Sequence seems to be composed of three different integers 3, 16 and 19. Further comments in A293700.

Crossrefs

Programs

  • Mathematica
    rootsn = Flatten[Position[Table[Floor[Tan[-n]], {n, 1, 10^6}], 1]];
    difn = Differences[rootsn];

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

Original entry on oeis.org

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
Offset: 1

Views

Author

V.J. Pohjola, Oct 21 2017

Keywords

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.

Examples

			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.
		

Crossrefs

Programs

  • 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]]*)

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

Original entry on oeis.org

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, -3, -4, -5, -6, -7, -8, -9, -10, -11, -12, -13, -14, -15, -16, -17, -18, 18, 17, 16, 15, 14, 13, 12, 11, 10, 9, 8, 7, 6, 5, 4, 3, 2, 1, 0, -1, -2, -3, -4, -5
Offset: 1

Views

Author

V.J. Pohjola, Oct 21 2017

Keywords

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. When shift is a positive number, it indicates the number of steps that the palindrome has moved to the right from its symmetric position.

Examples

			For n = 1, 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 = 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.
		

Crossrefs

Programs

  • Mathematica
    rootsn = Flatten[Position[Table[Floor[Tan[-i]], {i, 1, 10^4}], 1]];
    difn = Differences[rootsn];
    ldn = Length[difn];
    kmax = 500; palsn = {}; lenpalsn = {0}; shiftn = {}; posn = {};
    Do[diffin = difn[[1 ;; k]]; lendiffin = Length[diffin];
      pmax = k - Last[lenpalsn];
      t = Table[difn[[p ;; k]], {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]]]];
      AppendTo[posn, Position[t, Last[palsn]]]; pp = Last[Flatten[posn]] - 1;
      qq = lendiffin - (pp + Last[lenpalsn]);
      AppendTo[shiftn, pp - qq], {k, 1, kmax}];
    shiftn (*a(n)=shiftn[[n]]*)

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.

Original entry on oeis.org

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

Views

Author

V.J. Pohjola, Oct 20 2017

Keywords

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.

Examples

			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.
		

Crossrefs

Programs

  • 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]]*)

A293706 a(n) is the shift of the longest palindromic subsequence within the first differences of the concatenation of the first n negative and positive roots of floor(tan(k)) = 1.

Original entry on oeis.org

0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 2, 4, 4, 6, 6, 8, 8, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10
Offset: 1

Views

Author

V.J. Pohjola, Oct 23 2017

Keywords

Comments

Shift is the measure of the position of a palindromic subsequence within the corresponding sequence of first differences, being defined as the number of terms omitted from the left end of the sequence of first differences minus those omitted from its right end. Thus, when shift is, say, 10, the position of the palindrome is 10 steps to the right from the center of the first differences.
a(n) remains at value 10 from n=18 to 1183 after which it drops stepwise linearly to -1544.

Examples

			For n = 1, roots=-18,1; differences = 19; longest palindrome = 19; a(n) = 0.
For n = 2, roots=-21, -18, 1, 4; differences = 3,19,3; longest palindrome = 3,19,3  a(2) = 0.
For n = 9, roots=-106, -90, -87, -84, -65, -62, -43, -40, -21, -18, 1, 4, 23, 26, 45, 48, 67, 70, 89, 92; differences = 16, 3, 3, 19, 3, 19, 3, 19, 3, 19, 3, 19, 3, 19, 3, 19, 3, 19, 3; longest palindrome = 3, 19, 3, 19, 3, 19, 3, 19, 3, 19, 3, 19, 3, 19, 3, 19, 3; a(9) = 2 - 0 = 2.
		

Crossrefs

Programs

  • Mathematica
    rootsA = {}; Do[
    If[Floor[Tan[i]] == 1, AppendTo[rootsA, i]], {i, -10^4, 10^4}]
    lenN = Length[Select[rootsA, # < 0 &]];
    r = 1000; roots = rootsA[[lenN - r ;; lenN + r + 1]];
    diff = Differences[roots];
    center = Length[roots]/2;
    pals = {}; lenpals = {}; lenpal = 1; pos = {}; shift = {};
    Do[diffn = diff[[center - (n - 1) ;; center + (n - 1)]];
    lendiffn = Length[diffn]; w = 3;
    lenpal = lenpal + 2; (Label[alku]; w = w - 1;
      pmax = lendiffn - lenpal - (w - 1);
      t = Table[diffn[[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]]]];
    AppendTo[pos, Flatten[Position[t, First[s]]]]; pp = Last[Flatten[pos]];
    qq = lendiffn - (pp - 1 + Last[lenpals]);
    AppendTo[shift, pp - 1 - qq], {n, 1, center}]
    shift
Showing 1-10 of 11 results. Next