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-3 of 3 results.

A026136 Lexicographically earliest permutation of the positive integers such that |a(n)-n| = [a(n)/2].

Original entry on oeis.org

1, 3, 2, 7, 9, 4, 5, 15, 6, 19, 21, 8, 25, 27, 10, 11, 33, 12, 13, 39, 14, 43, 45, 16, 17, 51, 18, 55, 57, 20, 61, 63, 22, 23, 69, 24, 73, 75, 26, 79, 81, 28, 29, 87, 30, 31, 93, 32, 97, 99, 34, 35, 105, 36, 37, 111, 38, 115, 117, 40, 41, 123
Offset: 1

Views

Author

Keywords

Comments

Old name was: For n >= 2, let L=n-[ n/2 ], R=n+[ n/2 ]; then a(L)=n if a(L) not yet defined, else a(R)=n; thus |a(n)-n|=[ (1/2)*a(n) ].
Also can be defined as follows. For n >= 2, let h=[ n/2 ], L=n-h, R=n+h; then a(R)=n if n even or a(L) already defined, else a(L)=n. For a proof that the two definitions are the same, see my paper "Permutations of N generated by left-right filling algorithms". - Michel Dekking, Jan 30 2020
From Peter Munn, Dec 30 2021: (Start)
A value m occurs at an index n, n < m if and only if m has the form 3^i*(6k+2)+1.
Proof:
Values of the form 2k occur at index 2k + [2k/2] = 3k and not at index 2k - [2k/2] = k, because a(k) can take the value 2k-1 and 2k-1 cannot occur earlier.
So, values of the form 6k+5 occur at index 6k+5 + [(6k+5)/2] = 9k+7, and not at index 6k+5 - [(6k+5)/2] = 3k+3 because a(3k+3) takes the value 2k+2.
Values of the form 6k+3 occur at index 6k+3 - [(6k+3)/2] = 3k+2, because numbers of the form 3k+2 do not have the form m+[m/2] for any m > 0.
A value of the form 6k+1 occurs at index 6k+1 - [(6k+1)/2] = 3k+1 if and only if 2k+1 occurs at index k+1 rather than occupying index 3k+1.
From the characterization above of cases 6k+5, 6k+3 and 6k+1 we see the following: an odd number 2j+1 > 2 occurs before or after position 2j+1 depending on the base 3 representation of j with its trailing zeros removed. (With respect to the statement being proved j = 3^i*(3k+1).)
(End)

Crossrefs

Programs

  • Mathematica
    Block[{a, nn = 123}, a[1] = 1; Do[If[! IntegerQ[a[#1]], Set[a[#1], i], Set[a[#2], i]] & @@ {i - #, i + #} &@ Floor[i/2], {i, nn}]; TakeWhile[Array[a[#] &, nn], IntegerQ]] (* Michael De Vlieger, Apr 16 2020 *)
  • PARI
    seq(n)={my(a=vector(n)); a[1]=1; for(i=2, 2*n, my(h=i\2); if(!a[i-h], a[i-h]=i, if(i+h<=n, a[i+h]=i))); a} \\ Andrew Howroyd, Oct 15 2019
  • Python
    import math
    A026136 ={1:1}
    for n in range(2,3000):
        h=math.floor(n/2)
        L=n-h
        R=n+h
        if not L in A026136 :
            A026136[L]=n
        else :
            A026136[R]=n
    for n in range(1,2000):
        if n in A026136:
           print(str(n) + " "+ str(A026136[n]))
        else:
           break # R. J. Mathar, Aug 26 2019
    

Extensions

Edited by N. J. A. Sloane, Jan 31 2020
New name from Peter Munn, Dec 30 2021

A026225 Numbers of the form 3^i * (3k+1).

Original entry on oeis.org

1, 3, 4, 7, 9, 10, 12, 13, 16, 19, 21, 22, 25, 27, 28, 30, 31, 34, 36, 37, 39, 40, 43, 46, 48, 49, 52, 55, 57, 58, 61, 63, 64, 66, 67, 70, 73, 75, 76, 79, 81, 82, 84, 85, 88, 90, 91, 93, 94, 97, 100, 102, 103, 106, 108, 109, 111, 112, 115
Offset: 1

Views

Author

Keywords

Comments

Old name: a(n) = (1/3)*(s(n+1) - 1), where s = A026224.
Conjectures based on old name: these are numbers of the form (3*i+1)*3^j; see A182828, and they comprise the complement of A026179, except for the initial 1 in A026179.
From Peter Munn, Mar 17 2022: (Start)
Numbers with an even number of prime factors of the form 3k-1 counting repetitions.
Numbers whose squarefree part is congruent to 1 modulo 3 or 3 modulo 9.
The integers in an index 2 subgroup of the positive rationals under multiplication. As such the sequence is closed under multiplication and - where the result is an integer - under division; also for any positive integer k not in the sequence, the sequence's complement is generated by dividing by k the terms that are multiples of k.
Alternatively, the sequence can be viewed as an index 2 subgroup of the positive integers under the commutative binary operation A059897(.,.).
Viewed either way, the sequence corresponds to a subgroup of the quotient group derived in the corresponding way from A055047. (End)
The asymptotic density of this sequence is 1/2. - Amiram Eldar, Apr 03 2022
Is this A026140 shifted right? - R. J. Mathar, Jun 24 2025

Crossrefs

Elements of array A182828 in ascending order.
Union of A055041 and A055047.
Other subsequences: A007645 (primes), A352274.
Symmetric difference of A003159 and A225838; of A007417 and A189716.

Programs

  • Mathematica
    a[b_] := Table[Mod[n/b^IntegerExponent[n, b], b], {n, 1, 160}]
    p[b_, d_] := Flatten[Position[a[b], d]]
    p[3, 1]  (* A026225 *)
    p[3, 2] (* A026179 without initial 1 *)
    (* Clark Kimberling, Oct 19 2016 *)
  • PARI
    isok(m) = core(m) % 3 == 1 || core(m) % 9 == 3; \\ Peter Munn, Mar 17 2022
    
  • Python
    from sympy import integer_log
    def A026225(n):
        def f(x): return n+x-sum(((x//3**i)-1)//3+1 for i in range(integer_log(x,3)[0]+1))
        m, k = n, f(n)
        while m != k: m, k = k, f(k)
        return m # Chai Wah Wu, Feb 15 2025

Formula

From Peter Munn, Mar 17 2022: (Start)
{a(n) : n >= 1} = {m : A001222(A343430(m)) == 0 (mod 2)}.
{a(n) : n >= 1} = {A055047(m) : m >= 1} U {3*A055047(m) : m >= 1}.
{a(n) : n >= 1} = {A352274(m) : m >= 1} U {A352274(m)/10 : m >= 1, 10 divides A352274(m)}. (End)

Extensions

New name from Peter Munn, Mar 17 2022

A026142 Lexicographically earliest permutation of the positive integers such that for n >= 2, |a(n)-n| = [(a(n)+1)/2].

Original entry on oeis.org

1, 4, 2, 8, 3, 12, 14, 5, 6, 20, 7, 24, 26, 9, 10, 32, 11, 36, 38, 13, 42, 44, 15, 16, 50, 17, 18, 56, 19, 60, 62, 21, 22, 68, 23, 72, 74, 25, 78, 80, 27, 28, 86, 29, 30, 92, 31, 96, 98, 33, 34, 104, 35, 108, 110, 37, 114, 116, 39, 40, 122, 41, 126, 128, 43, 132
Offset: 1

Views

Author

Keywords

Comments

Old name: For n >= 2, let h=[ (n+1)/2 ], L=n-h, R=n+h; a(L)=n if a(L) not yet defined, else a(R)=n; thus |a(n)-n| = [ (a(n)+1)/2 ].
From Peter Munn, Jan 07 2022: (Start)
A value m occurs at an index n, n < m if and only if m has the form 3^i*4 or 3^i*(6k+2), k >= 1.
Proof:
For k >= 1, values of the form 2k+1 occur at index 2k+1 + [(2k+1+1)/2] = 3k+2 and not at index 2k+1 - [(2k+1+1)/2] = k, because a(k) can take the value 2k and 2k cannot occur earlier.
So, for k >= 1, values of the form 6k+4 occur at index 6k+4 + [(6k+4+1)/2] = 9k+6, and not at index 6k+4 - [(6k+4+1)/2] = 3k+2 because a(3k+2) takes the value 2k+1.
For k >= 1, values of the form 6k+2 occur at index 6k+2 - [(6k+2+1)/2] = 3k+1, because numbers of the form 3k+1 do not have the form m+[(m+1)/2] for any m > 0. (Note that for k = 0, 1 occurs at index 1 due to an explicit exemption from the definition's constraining rule.)
A value of the form 6k occurs at index 6k - [(6k+1)/2] = 3k if and only if 2k occurs at index k rather than occupying index 3k.
From the characterization above of cases 6k+4, 6k+2 and 6k we see the following: an even number 2j > 4 occurs before or after position 2j depending on the base 3 representation of j with its trailing zeros removed. (With respect to the statement being proved j = 3^i*2 or 3^i*(3k+1).)
(End)

Crossrefs

Programs

  • Mathematica
    Block[{a, nn = 132}, a[1] = 1; Do[If[! IntegerQ[a[#1]], Set[a[#1], i], Set[a[#2], i]] & @@ {i - #, i + #} &@ Floor[(i + 1)/2], {i, nn}]; TakeWhile[Array[a[#] &, nn], IntegerQ]] (* Michael De Vlieger, Apr 17 2020 *)

Extensions

New name from Peter Munn, Jan 07 2022
Showing 1-3 of 3 results.