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.

Original entry on oeis.org

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, 23, 30, 31, 32, 33, 26, 19, 12, 11, 10, 9, 8, 7, 14, 21, 28, 35, 42, 43, 44, 45, 46, 47, 48, 97, 146, 195, 244, 293, 292, 291, 290, 289, 288, 239, 190, 141, 142, 143, 144, 193, 192
Offset: 0

Views

Author

M. F. Hasler, Mar 13 2018

Keywords

Comments

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:
.
(0,6)--(1,6)--(2,6)--(3,6)--(4,6)--(5,6) (6,6)
| | |
| | |
(0,5) (1,5)--(2,5)--(3,5)--(4,5) (5,5) (6,5)
| | | | |
| | | | |
(0,4) (1,4) (2,4)--(3,4) (4,4) (5,4) (6,4)
| | | | | | |
| | | | | | |
(0,3) (1,3) (2,3) (3,3) (4,3) (5,3) (6,3)
| | | | | | |
| | | | | | |
(0,2) (1,2) (2,2) (3,2)--(4,2) (5,2) (6,2)
| | | | |
| | | | |
(0,1) (1,1) (2,1)--(3,1)--(4,1)--(5,1) (6,1)
| | |
| | |
(0,0) (1,0)--(2,0)--(3,0)--(4,0)--(5,0)--(6,0)
.
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.
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.

Crossrefs

Cf. A220952 (Knuth's original base-5 variant), A300856 (inverse permutation), A300855 (inverse of A220952).

Programs

  • 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))}
    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)))