login
The OEIS is supported by the many generous donors to the OEIS Foundation.

 

Logo
Hints
(Greetings from The On-Line Encyclopedia of Integer Sequences!)
A300857 Base-7 based twisted permutation of the nonnegative integers. 5

%I #14 Mar 15 2018 05:49:31

%S 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 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 97,146,195,244,293,292,291,290,289,288,239,190,141,142,143,144,193,192

%N Base-7 based twisted permutation of the nonnegative integers.

%C 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 .

%C (0,6)--(1,6)--(2,6)--(3,6)--(4,6)--(5,6) (6,6)

%C | | |

%C | | |

%C (0,5) (1,5)--(2,5)--(3,5)--(4,5) (5,5) (6,5)

%C | | | | |

%C | | | | |

%C (0,4) (1,4) (2,4)--(3,4) (4,4) (5,4) (6,4)

%C | | | | | | |

%C | | | | | | |

%C (0,3) (1,3) (2,3) (3,3) (4,3) (5,3) (6,3)

%C | | | | | | |

%C | | | | | | |

%C (0,2) (1,2) (2,2) (3,2)--(4,2) (5,2) (6,2)

%C | | | | |

%C | | | | |

%C (0,1) (1,1) (2,1)--(3,1)--(4,1)--(5,1) (6,1)

%C | | |

%C | | |

%C (0,0) (1,0)--(2,0)--(3,0)--(4,0)--(5,0)--(6,0)

%C .

%C 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 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 M. F. Hasler, <a href="/A300857/b300857.txt">Table of n, a(n) for n = 0..1000</a>

%H <a href="/index/Per#permutation">Index entries related to permutations</a>.

%o (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 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 Cf. A220952 (Knuth's original base-5 variant), A300856 (inverse permutation), A300855 (inverse of A220952).

%K nonn,base,nice

%O 0,3

%A _M. F. Hasler_, Mar 13 2018

Lookup | Welcome | Wiki | Register | Music | Plot 2 | Demos | Index | Browse | More | WebCam
Contribute new seq. or comment | Format | Style Sheet | Transforms | Superseeker | Recents
The OEIS Community | Maintained by The OEIS Foundation Inc.

License Agreements, Terms of Use, Privacy Policy. .

Last modified March 28 09:04 EDT 2024. Contains 371240 sequences. (Running on oeis4.)