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.

A300857 Base-7 based twisted permutation of the nonnegative integers.

This page as a plain text file.
%I A300857 #14 Mar 15 2018 05:49:31
%S A300857 0,1,2,3,4,5,6,13,20,27,34,41,40,39,38,37,36,29,22,15,16,17,18,25,24,
%T A300857 23,30,31,32,33,26,19,12,11,10,9,8,7,14,21,28,35,42,43,44,45,46,47,48,
%U A300857 97,146,195,244,293,292,291,290,289,288,239,190,141,142,143,144,193,192
%N A300857 Base-7 based twisted permutation of the nonnegative integers.
%C A300857 Base-7 variant of Knuth's A220952, i.e., two numbers a, b are adjacent iff for all i > j, the pairs (a_i,a_j) and (b_i,b_j) (where indices denote base-7 digits: a = Sum_{k>=0} a_k*7^k), are equal or neighbors in the following graph:
%C A300857   .
%C A300857   (0,6)--(1,6)--(2,6)--(3,6)--(4,6)--(5,6)  (6,6)
%C A300857     |                                  |      |
%C A300857     |                                  |      |
%C A300857   (0,5)  (1,5)--(2,5)--(3,5)--(4,5)  (5,5)  (6,5)
%C A300857     |      |                    |      |      |
%C A300857     |      |                    |      |      |
%C A300857   (0,4)  (1,4)  (2,4)--(3,4)  (4,4)  (5,4)  (6,4)
%C A300857     |      |      |      |      |      |      |
%C A300857     |      |      |      |      |      |      |
%C A300857   (0,3)  (1,3)  (2,3)  (3,3)  (4,3)  (5,3)  (6,3)
%C A300857     |      |      |      |      |      |      |
%C A300857     |      |      |      |      |      |      |
%C A300857   (0,2)  (1,2)  (2,2)  (3,2)--(4,2)  (5,2)  (6,2)
%C A300857     |      |      |                    |      |
%C A300857     |      |      |                    |      |
%C A300857   (0,1)  (1,1)  (2,1)--(3,1)--(4,1)--(5,1)  (6,1)
%C A300857     |      |                                  |
%C A300857     |      |                                  |
%C A300857   (0,0)  (1,0)--(2,0)--(3,0)--(4,0)--(5,0)--(6,0)
%C A300857   .
%C A300857 It turns out that for any positive integer there are exactly two other adjacent nonnegative integers, and this sequence in which (a(n),a(n+1)) are pairs of adjacent integers, defines a permutation of the nonnegative integers.
%C A300857 The analog graph for base-3 would yield more than two other adjacent numbers for some n, e.g., n = 5 would be adjacent to 3, 4, 6, 7, and 8. For even bases there is not an exact analog of this graph.
%H A300857 M. F. Hasler, <a href="/A300857/b300857.txt">Table of n, a(n) for n = 0..1000</a>
%H A300857 <a href="/index/Per#permutation">Index entries related to permutations</a>.
%o A300857 (PARI) isAdj(a,b)={a=Vec(digits(min(a,b),7),-#b=concat(0,digits(max(a,b),7))); normlp(a-b,1)<2 && !for(j=2,#b, for(i=1,j-1, if(a[i]==b[i], !a[i] || a[i]==6 || (a[i]==5 && min(a[j],b[j])) || (a[i]==1 && max(a[j],b[j])<6) || (a[i]==2 && !#setminus(Set([a[j],b[j]]),[1,2,3,4])) || (a[i]==4 && !#setminus(Set([a[j],b[j]]),[2,3,4,5])) || (a[i]==3 && !#setminus(Set([a[j],b[j]]),[2,3,4])) || a[j]==b[j], (!a[j] && min(a[i],b[i])) || (a[j]==6 && max(a[i],b[i])<6) || (a[j]==1 && !#setminus(Set([a[i],b[i]]),[2,3,4,5])) || (a[j]==5 && !#setminus(Set([a[i],b[i]]),[1,2,3,4])) || (a[j]==4 && Set([a[i],b[i]])==[2,3]) || (a[j]==2 && Set([a[i],b[i]])==[3,4]) || a[i]==b[i]) || return))}
%o A300857 u=[]; for(n=a=0, 100, print1(a", "); u=setunion(u, [a]); while(#u>1&&u[2]==u[1]+1, u=u[^1]); for(k=u[1]+1, oo, !setsearch(u, k)&&isAdj(a, k)&&(a=k)&&next(2)))
%Y A300857 Cf. A220952 (Knuth's original base-5 variant), A300856 (inverse permutation), A300855 (inverse of A220952).
%K A300857 nonn,base,nice
%O A300857 0,3
%A A300857 _M. F. Hasler_, Mar 13 2018