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.

A290691 Triangle read by rows: infinite braid made of periodically-colored yarns in which the crossing of two adjacent yarns occurs when two color 0's are side by side (see comments).

This page as a plain text file.
%I A290691 #33 Apr 07 2020 23:12:03
%S A290691 1,0,2,1,1,3,0,0,2,4,2,1,1,3,5,1,0,0,2,4,6,0,3,1,1,3,5,7,2,2,0,0,2,4,
%T A290691 6,8,1,1,4,1,1,3,5,7,9,0,0,3,0,0,2,4,6,8,10,3,2,2,5,1,1,3,5,7,9,11,2,
%U A290691 1,1,4,0,0,2,4,6,8,10,12,1,0,0,3,6,1,1
%N A290691 Triangle read by rows: infinite braid made of periodically-colored yarns in which the crossing of two adjacent yarns occurs when two color 0's are side by side (see comments).
%C A290691 Construction: row numbers start at n = 3; column numbers run from k = 1 to k = n - 2. For all y >= 2, a yarn called "yarn y" is made of the repeated (y - 1, y - 2, ..., 1, 0) sequence. Pin it (for now vertically) at coordinates (y + 1, y - 1). Progress by increasing n: for a given row n, if two adjacent yarns show side by side 0's, then cross them at this point.
%C A290691 Properties: n is a prime iff there is no 0 in row n. n is a square iff there is an isolated 0 in row n column 1. If there is a crossing between yarn y1 and yarn y2 in row n, then n = y1 * y2.
%C A290691 Alternative definition: row n is the list of (-n) mod (y) sorted in ascending order of abs(y - n / y), for all y candidate divisor of n, y between 2 and (n - 1) inclusive.
%F A290691 T(n,k) = (-n) mod y(n,k), with y(n,k) the yarn going through (n,k); ambiguity at a crossing doesn't matter, both mod yielding 0.
%e A290691 Array begins:
%e A290691 1
%e A290691 0  2
%e A290691 1  1  3
%e A290691 0  0  2  4
%e A290691 2  1  1  3  5
%e A290691 1  0  0  2  4  6
%e A290691 0  3  1  1  3  5  7
%e A290691 2  2  0  0  2  4  6  8
%e A290691 1  1  4  1  1  3  5  7  9
%e A290691 ...
%e A290691 Viewed as a braid (pairs of adjacent zeros being replaced by crossings):
%e A290691         1   2   3   4   5   6   7   8   9  10  11  12  13  14  15  ------> k
%e A290691       .
%e A290691    3    1
%e A290691         |
%e A290691    4    0   2
%e A290691         |   |
%e A290691    5    1   1   3
%e A290691          \ /    |
%e A290691    6      0     2   4
%e A290691          / \    |   |
%e A290691    7    2   1   1   3   5
%e A290691         |    \ /    |   |
%e A290691    8    1     0     2   4   6
%e A290691         |    / \    |   |   |
%e A290691    9    0   3   1   1   3   5   7
%e A290691         |   |    \ /    |   |   |
%e A290691   10    2   2     0     2   4   6   8
%e A290691         |   |    / \    |   |   |   |
%e A290691   11    1   1   4   1   1   3   5   7   9
%e A290691          \ /    |    \ /    |   |   |   |
%e A290691   12      0     3     0     2   4   6   8  10
%e A290691          / \    |    / \    |   |   |   |   |
%e A290691   13    3   2   2   5   1   1   3   5   7   9  11
%e A290691         |   |   |   |    \ /    |   |   |   |   |
%e A290691   14    2   1   1   4     0     2   4   6   8  10  12
%e A290691         |    \ /    |    / \    |   |   |   |   |   |
%e A290691   15    1     0     3   6   1   1   3   5   7   9  11  13
%e A290691         |    / \    |   |    \ /    |   |   |   |   |   |
%e A290691   16    0   4   2   2   5     0     2   4   6   8  10  12  14
%e A290691         |   |   |   |   |    / \    |   |   |   |   |   |   |
%e A290691   17    3   3   1   1   4   7   1   1   3   5   7   9  11  13  15
%e A290691    |
%e A290691    V   ...
%e A290691    n
%t A290691 Ev[E_] := Module[{x, dx}, x = First[E]; dx = Last[E]; If[x == 0 && dx < 0, {-dx, -dx}, {x + dx, dx}]]
%t A290691 EvL[n_, L_] := Module[{LL}, LL = Ev /@ L; LL = Sort[LL]; LL = Append[LL, {n - 1, -1/n}]; LL]
%t A290691 It[nStart_, nEnd_, LStart_] := Module[{n, LL}, For[n = nStart; LL = LStart, n <= nEnd, n++, LL = EvL[n, LL]]; LL]
%t A290691 Encours[n_] := It[2, n, {}]
%t A290691 Countdown[x_, dx_] := If[dx > 0, (Ceiling[x] - x)/dx, (Floor[x] - x)/dx]
%t A290691 A[n_] := Drop[Apply[Countdown, #] & /@ Encours[n], -1]
%t A290691 Table[A[n], {n, 2, 25}] // Flatten
%t A290691 (* or *)
%t A290691 (Last /@ # &) /@ Sort /@ Table[{Abs[k - n/k], Mod[-n, k]}, {n, 3, 20}, {k, 2, n - 1}] // Flatten
%o A290691 (C)
%o A290691 #include <stdio.h>
%o A290691 #include <stdlib.h>
%o A290691 #include <string.h>
%o A290691 #define NMAX 40
%o A290691 struct cell { int f; int v; };
%o A290691 struct line { struct cell t[NMAX]; };
%o A290691 void display(struct line *T) { int n, k; for (n = 3; n <= NMAX; n ++) { for (k = 1; k < n - 1; k ++) { printf("%2d, ", T[n].t[k].v, T[n].t[k].f); } printf("\n"); } }
%o A290691 void swap(int *a, int *b) { int x; x = *a; *a = *b; *b = x; }
%o A290691 void fill(struct line *T)
%o A290691 {
%o A290691     int n, k;
%o A290691     for (n = 3; n <= NMAX; n ++)
%o A290691     {
%o A290691         for (k = 1; k < n - 2; k ++)
%o A290691         {
%o A290691             T[n].t[k].v = T[n - 1].t[k].v - 1;
%o A290691             T[n].t[k].f = T[n - 1].t[k].f;
%o A290691         }
%o A290691         T[n].t[n - 2].v = n - 2;
%o A290691         T[n].t[n - 2].f = n - 1;
%o A290691         for (k = 1; k < n - 2; k ++)
%o A290691         {
%o A290691             if ((T[n].t[k].v == 0) && (T[n].t[k + 1].v == 0))
%o A290691             {
%o A290691                 swap(&T[n].t[k].f, &T[n].t[k + 1].f);
%o A290691             }
%o A290691         }
%o A290691         for (k = 1; k < n - 2; k ++)
%o A290691         {
%o A290691             if (T[n].t[k].v == -1)
%o A290691             {
%o A290691                 T[n].t[k].v += T[n].t[k].f;
%o A290691             }
%o A290691         }
%o A290691     }
%o A290691 }
%o A290691 int main() { struct line T[NMAX + 1]; memset(T, 0x0, sizeof(T)); fill(T); display(T); }
%Y A290691 Cf. A293578.
%K A290691 nonn,tabl
%O A290691 1,3
%A A290691 _Luc Rousseau_, Oct 20 2017