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.

Showing 1-4 of 4 results.

A300856 Inverse of the base-7 based twisted permutation A300857 of the nonnegative integers.

Original entry on oeis.org

0, 1, 2, 3, 4, 5, 6, 37, 36, 35, 34, 33, 32, 7, 38, 19, 20, 21, 22, 31, 8, 39, 18, 25, 24, 23, 30, 9, 40, 17, 26, 27, 28, 29, 10, 41, 16, 15, 14, 13, 12, 11, 42, 43, 44, 45, 46, 47, 48, 289, 288, 287, 286, 285, 284, 259, 108, 109, 110, 111, 112, 113, 258, 107, 126, 125
Offset: 0

Views

Author

M. F. Hasler, Mar 13 2018

Keywords

Examples

			A300857(37) = 7, therefore a(7) = 37.
		

Crossrefs

Cf. A300857 (inverse); A300855 = inverse of Knuth's original base-5 analog A220952.

Programs

  • PARI
    vecsort(A300857,,1) \\ where A300857 is a vector of some N initial terms of that sequence without the leading a(0) = 0 and such that these N values contain exactly all integers from 1 to N, e.g., N = 300.

A220952 A twisted enumeration of the nonnegative integers.

Original entry on oeis.org

0, 1, 2, 3, 4, 9, 14, 19, 18, 17, 16, 11, 12, 13, 8, 7, 6, 5, 10, 15, 20, 21, 22, 23, 24, 49, 74, 99, 98, 97, 96, 71, 72, 73, 48, 47, 46, 45, 70, 95, 90, 85, 80, 55, 60, 65, 40, 35, 30, 31, 32, 33, 38, 37, 36, 41, 42, 43, 68, 67, 66, 61, 62, 63, 58, 57, 56, 81, 82, 83, 88
Offset: 0

Views

Author

Don Knuth, Feb 20 2013

Keywords

Comments

Initially Don Knuth gave as the definition of this sequence "A sequence that I'm submitting as a problem for publication (see note in comments!)" and the comment that "As soon as a solution is published, I'll provide lots more info; the sequence is so fascinating, it has caused me to take three days off from writing The Art of Computer Programming, but I plan to use it in Chapter 8 some day."
In order for the definition to make sense, it looks like any integer has to be preceded by infinitely many zeros in its base-5 representation. This ensures that the condition is not vacuous for single-digit numbers, so that (except for 0) they also have two adjacent numbers. - Jean-Paul Allouche, Aug 25 2017
[Obviously it is understood that a_i = 0 for all i > log_5(a)+1. But it is sufficient to take all i < log_5(max(a,b))+2, i.e., to consider just one "leading zero" for the larger number, and as many digits for the smaller number. - M. F. Hasler, Mar 13 2018]
From Andrey Zabolotskiy, Feb 21 2018: (Start)
The sequence is defined by Knuth as follows.
Say that nonnegative integers a and b are adjacent when their base-5 expansions ...a_2 a_1 a_0 and ...b_2 b_1 b_0 satisfy the condition that if i > j then the pairs of base-5 digits (a_i,a_j) and (b_i,b_j) are either equal or consecutive in the path through {0, 1, 2, 3, 4}^2 shown at the diagram:
.
(0,4)--(1,4)--(2,4)--(3,4) (4,4)
| | |
| | |
(0,3) (1,3)--(2,3) (3,3) (4,3)
| | | | |
| | | | |
(0,2) (1,2) (2,2) (3,2) (4,2)
| | | | |
| | | | |
(0,1) (1,1) (2,1)--(3,1) (4,1)
| | |
| | |
(0,0) (1,0)--(2,0)--(3,0)--(4,0)
.
Actually, every positive integer is adjacent to exactly two nonnegative integers, and we can write down a permutation of nonnegative integers starting with 0 such that the two consecutive numbers in it are adjacent. That permutation is this sequence.
(End)
From Daniel Forgues, Feb 22 2018: (Start)
The first differences appear to be +- 5^k, for some k >= 0.
Fractal behavior: when n = 5^k - 1, k >= 2, a similar image is completed.
(End)
The first differences are +- 5^k, this is a Gray code in base 5. - Joerg Arndt, Feb 05 2022

Examples

			48 (equals 143 in base 5) is adjacent to 47 = 142_5 and 73 = 243_5, hence 48 follows 73 and precedes 47.
		

Crossrefs

See A300855 for the inverse permutation, A300857 for the base-7 variant.

Programs

  • Maple
    # See the link, R. J. Mathar, Aug 25 2017
  • PARI
    isAdj(a,b)={a=Vec(digits(min(a,b),5),-#b=concat(0,digits(max(a,b),5))); normlp(a-b,1)<2 && !for(j=2,#b, for(i=1,j-1, if(a[i]==b[i], !a[i] || a[i]==4 || (a[i]==3 && min(a[j],b[j])) || (a[i]==1 && max(a[j],b[j])<4) || (a[i]==2 && !#setminus(Set([a[j],b[j]]),[1,2,3])) || a[j]==b[j], (!a[j] && min(a[i],b[i])) || (a[j]==4 && max(a[i],b[i])<4) || (a[j]==1 && Set([a[i],b[i]])==[2,3]) || (a[j]==3 && Set([a[i],b[i]])==[1,2]) || 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))) \\ M. F. Hasler, Mar 13 2018

Extensions

Extended beyond a(25) by R. J. Mathar, Aug 25 2017

A300855 Inverse of Knuth's base-5 based twisted permutation A220952 of the nonnegative integers.

Original entry on oeis.org

0, 1, 2, 3, 4, 17, 16, 15, 14, 5, 18, 11, 12, 13, 6, 19, 10, 9, 8, 7, 20, 21, 22, 23, 24, 97, 96, 95, 94, 85, 48, 49, 50, 51, 84, 47, 54, 53, 52, 83, 46, 55, 56, 57, 82, 37, 36, 35, 34, 25, 98, 91, 92, 93, 86, 43, 66, 65, 64, 79, 44, 61, 62, 63, 80, 45, 60, 59, 58, 81
Offset: 0

Views

Author

M. F. Hasler, Mar 13 2018

Keywords

Crossrefs

See A220952 for the inverse permutation, A300857 and its inverse A300856 for the base-7 variant.

Programs

  • PARI
    concat(0,Vec(vecsort(A220952,,1))) \\ where A220952 is a vector of some N initial terms of that sequence without the leading a(0) = 0 (use ...[^1] to exclude the first element if needed) and such that these N values contain exactly all integers from 1 to N, e.g., N = 120.

Formula

A220952(9) = 5, therefore a(5) = 9.

A307406 Number of twisted permutations of the nonnegative integers in base 2*n+1 with an adjacency diagram as defined by Knuth in A220952.

Original entry on oeis.org

1, 1, 5, 47
Offset: 0

Views

Author

Georg Fischer, Apr 07 2019

Keywords

Comments

The concept of the adjacency diagram in A220952 is not limited to base 5, but can be investigated for all odd bases. In "base 1", the path consists of a single node (1,1). For base 3, there is the ternary Gray code A128173 only. A corresponding simple up-down pattern with a path (0,0), ... (0,n), (1,n), ... (1,0), (2,0), ... (n,n) can be constructed for any odd base.
Conjecture: a(4) = 673.

Crossrefs

Cf. A128173 (base 3, "n"), A220952 (Knuth, base 5, "Hn"), A307403 ("Hs"), A307404 ("Ln"), A307405 ("Ls"), A300857 (base 7).

Programs

  • Perl
    cf. link
Showing 1-4 of 4 results.