OFFSET
0,3
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.
LINKS
PROG
(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)))
CROSSREFS
KEYWORD
nonn,base,nice
AUTHOR
M. F. Hasler, Mar 13 2018
STATUS
approved
