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

A001196 Double-bitters: only even length runs in binary expansion.

Original entry on oeis.org

0, 3, 12, 15, 48, 51, 60, 63, 192, 195, 204, 207, 240, 243, 252, 255, 768, 771, 780, 783, 816, 819, 828, 831, 960, 963, 972, 975, 1008, 1011, 1020, 1023, 3072, 3075, 3084, 3087, 3120, 3123, 3132, 3135, 3264, 3267, 3276, 3279, 3312, 3315, 3324, 3327, 3840, 3843
Offset: 0

Views

Author

N. J. A. Sloane, based on an email from Bart la Bastide (bart(AT)xs4all.nl)

Keywords

Comments

Numbers whose set of base 4 digits is {0,3}. - Ray Chandler, Aug 03 2004
n such that there exists a permutation p_1, ..., p_n of 1, ..., n such that i + p_i is a power of 4 for every i. - Ray Chandler, Aug 03 2004
The first 2^n terms of the sequence could be obtained using the Cantor-like process for the segment [0, 4^n-1]. E.g., for n=1 we have [0, {1, 2}, 3] such that numbers outside of braces are the first 2 terms of the sequence; for n=2 we have [0, {1, 2}, 3, {4, 5, 6, 7, 8, 9, 10, 11}, 12, {13, 14}, 15] such that the numbers outside of braces are the first 4 terms of the sequence, etc. - Vladimir Shevelev, Dec 17 2012
From Emeric Deutsch, Jan 26 2018: (Start)
Also, the indices of the compositions having only even parts. For the definition of the index of a composition, see A298644. For example, 195 is in the sequence since its binary form is 11000011 and the composition [2,4,2] has only even parts. 132 is not in the sequence since its binary form is 10000100 and the composition [1,4,1,2] also has odd parts.
The command c(n) from the Maple program yields the composition having index n. (End)
After the k-th step of generating the Koch snowflake curve, label the edges of the curve consecutively 0..3*4^k-1 starting from a vertex of the originating triangle. a(0), a(1), ... a(2^k-1) are the labels of the edges contained in one edge of the originating triangle. Add 4^k to each label to get the labels for the next edge of the triangle. Compare with A191108 in respect of the Sierpinski arrowhead curve. - Peter Munn, Aug 18 2019

Crossrefs

3 times the Moser-de Bruijn sequence A000695.
Two digits in other bases: A005823, A097252-A097262.
Digit duplication in other bases: A338086, A338754.
Main diagonal of A054238.
Cf. A191108.

Programs

  • C
    int a_next(int a_n) { int t = a_n << 1; return a_n ^ t ^ (t + 3); } /* Falk Hüffner, Jan 24 2022 */
  • Haskell
    a001196 n = if n == 0 then 0 else 4 * a001196 n' + 3 * b
                where (n',b) = divMod n 2
    -- Reinhard Zumkeller, Feb 21 2014
    
  • Maple
    Runs := proc (L) local j, r, i, k: j := 1: r[j] := L[1]: for i from 2 to nops(L) do if L[i] = L[i-1] then r[j] := r[j], L[i] else j := j+1: r[j] := L[i] end if end do: [seq([r[k]], k = 1 .. j)] end proc: RunLengths := proc (L) map(nops, Runs(L)) end proc: c := proc (n) ListTools:-Reverse(convert(n, base, 2)): RunLengths(%) end proc: A := {}: for n to 3350 do if type(product(1+c(n)[j], j = 1 .. nops(c(n))), odd) = true then A := `union`(A, {n}) else  end if end do: A; # most of the Maple  program is due to W. Edwin Clark. - Emeric Deutsch, Jan 26 2018
    # second Maple program:
    a:= proc(n) option remember;
         `if`(n<2, 3*n, 4*a(iquo(n, 2, 'r'))+3*r)
        end:
    seq(a(n), n=0..100);  # Alois P. Heinz, Jan 24 2022
  • Mathematica
    fQ[n_] := Union@ Mod[Length@# & /@ Split@ IntegerDigits[n, 2], 2] == {0}; Select[ Range@ 10000, fQ] (* Or *)
    fQ[n_] := Union@ Join[IntegerDigits[n, 4], {0, 3}] == {0, 3}; Select[ Range@ 10000, fQ] (* Robert G. Wilson v, Dec 24 2012 *)
  • PARI
    a(n) = 3*fromdigits(binary(n),4); \\ Kevin Ryde, Nov 07 2020
    
  • Python
    def inA001196(n):
        while n != 0:
            if n%4 == 1 or n%4 == 2:
                return 0
            n = n//4
        return 1
    n, a = 0, 0
    while n < 20:
        if inA001196(a):
            print(n,a)
            n = n+1
        a = a+1 # A.H.M. Smeets, Aug 19 2019
    
  • Python
    from itertools import groupby
    def ok2lb(n):
      if n == 0: return True  # by convention
      return all(len(list(g))%2 == 0 for k, g in groupby(bin(n)[2:]))
    print([i for i in range(3313) if ok2lb(i)]) # Michael S. Branicky, Jan 04 2021
    
  • Python
    def A001196(n): return 3*int(bin(n)[2:],4) # Chai Wah Wu, Aug 21 2023
    

Formula

a(2n) = 4*a(n), a(2n+1) = 4*a(n) + 3.
a(n) = 3 * A000695(n).
Sum_{n>=1} 1/a(n) = 0.628725478158702414849086504025451177643560169366348272891020450593453403709... (calculated using Baillie and Schmelzer's kempnerSums.nb, see Links). - Amiram Eldar, Feb 12 2022

A037314 Numbers whose base-3 and base-9 expansions have the same digit sum.

Original entry on oeis.org

0, 1, 2, 9, 10, 11, 18, 19, 20, 81, 82, 83, 90, 91, 92, 99, 100, 101, 162, 163, 164, 171, 172, 173, 180, 181, 182, 729, 730, 731, 738, 739, 740, 747, 748, 749, 810, 811, 812, 819, 820, 821, 828, 829, 830, 891, 892, 893, 900, 901, 902, 909, 910, 911
Offset: 0

Views

Author

Keywords

Comments

a(n) = Sum_{i=0..m} d(i)*9^i, where Sum_{i=0..m} d(i)*3^i is the base-3 representation of n.
Numbers that can be written using only digits 0, 1 and 2 in base 9. Also, write n in base 3, read as base 9: (3) [n] (9) in base change notation. a(3n+k) = 9a(n)+k for k in {0,1,2}. - Franklin T. Adams-Watters, Jul 24 2006
Also, every term k corresponds to a unique pair i,j with k = a(i) + 3*a(j) (similarly to the Moser-de Bruijn sequence). - Luis Rato, May 02 2024

Crossrefs

Cf. A007089, A208665, A338086 (ternary digit duplication).

Programs

  • Julia
    function a(n)
        m, r, b = n, 0, 1
        while m > 0
            m, q = divrem(m, 3)
            r += b * q
            b *= 9
        end
    r end
    [a(n) for n in 0:53] |> println # Peter Luschny, Jan 03 2021
  • Mathematica
    Table[FromDigits[RealDigits[n, 3], 9], {n, 1, 100}] (* Clark Kimberling, Aug 14 2012 *)
    Select[Range[0,1000],Total[IntegerDigits[#,3]]==Total[IntegerDigits[#,9]]&] (* Harvey P. Dale, Feb 17 2020 *)
  • PARI
    a(n) = {my(d = digits(n, 3)); subst(Pol(d), x, 9);} \\ Michel Marcus, Apr 09 2015
    

Formula

G.f. f(x) = Sum_{j>=0} 9^j*x^(3^j)*(1+x^(3^j)-2*x^(2*3^j))/((1-x)*(1-x^(3^(j+1)))) satisfies f(x) = 9*(x^2+x+1)*f(x^3) + x*(1+2*x)/(1-x^3). - Robert Israel, Apr 13 2015

Extensions

Edited by N. J. A. Sloane at the suggestion of Andrew S. Plewe, Jun 08 2007
Offset changed to 0 by Clark Kimberling, Aug 14 2012

A338754 Duplicate each decimal digit of n, so 0 -> 00, ..., 9 -> 99.

Original entry on oeis.org

0, 11, 22, 33, 44, 55, 66, 77, 88, 99, 1100, 1111, 1122, 1133, 1144, 1155, 1166, 1177, 1188, 1199, 2200, 2211, 2222, 2233, 2244, 2255, 2266, 2277, 2288, 2299, 3300, 3311, 3322, 3333, 3344, 3355, 3366, 3377, 3388, 3399, 4400, 4411, 4422, 4433, 4444, 4455, 4466
Offset: 0

Views

Author

Kevin Ryde, Nov 06 2020

Keywords

Comments

This is equivalent to changing decimal digits 0,1,..,9 to base 100 digits 0,11,..,99, so the sequence is numbers which can be written in base 100 using only digits 0,11,..,99. Also, numbers whose decimal digit runs are all even lengths (including 0 as no digits at all).
This sequence first differs from A044836 (apart from term 0) at a(100) = 110000 whereas A044836(100) = 10011, because A044836 allows odd length digit runs provided there are more even than odd.

Examples

			For n=5517, digits duplicate to a(n) = 55551177.
		

Crossrefs

Cf. A051022 (0 above each digit), A044836.
Other bases: A001196, A338086.

Programs

  • PARI
    a(n) = fromdigits(digits(n),100)*11;
    
  • Python
    def A338754(n): return int(''.join(d*2 for d in str(n))) # Chai Wah Wu, May 07 2022

Formula

a(n) = Sum_{i=0..k} 11*d[i]*100^i where the decimal expansion of n is n = Sum_{i=0..k} d[i]*10^i with digits 0 <= d[i] <= 9.
a(n) = A051022(n)*11 for n > 0. - Kritsada Moomuang, Oct 20 2019

A208665 Numbers that match odd ternary polynomials; see Comments.

Original entry on oeis.org

3, 6, 27, 30, 33, 54, 57, 60, 243, 246, 249, 270, 273, 276, 297, 300, 303, 486, 489, 492, 513, 516, 519, 540, 543, 546, 2187, 2190, 2193, 2214, 2217, 2220, 2241, 2244, 2247, 2430, 2433, 2436, 2457, 2460, 2463, 2484, 2487, 2490, 2673, 2676, 2679
Offset: 1

Views

Author

Clark Kimberling, Feb 29 2012

Keywords

Comments

The ternary polynomials (having all coefficients in {0,1,2}) are enumerated at A207966. This sequence shows the numbers n for which p(n,-x)=-p(n,x).

Crossrefs

Cf. A037314, A207966, A338086 (ternary digit duplication).

Programs

  • Mathematica
    t = Table[IntegerDigits[n, 3], {n, 1, 4000}];
    b[n_] := Reverse[Table[x^k, {k, 0, n}]]
    p[n_, x_] := t[[n]].b[-1 + Length[t[[n]]]]
    Table[p[n, x], {n, 1, 30}]
    even = {}; Do[n++; If[(p[n, x] /. x -> -x) == p[n, x], AppendTo[even, n]], {n, 1600}];
    even     (* A037314 for n >= 2 *)
    odd = {}; Do[n++; If[(p[n, x] /. x -> -x) == -p[n, x], AppendTo[odd, n]], {n, 3900}];
    odd      (* A208665 *)
  • PARI
    a(n) = 3*fromdigits(digits(n,3),9); \\ Kevin Ryde, Oct 17 2020

A163343 Central diagonal of A163334 and A163336.

Original entry on oeis.org

0, 4, 8, 44, 40, 36, 72, 76, 80, 404, 400, 396, 360, 364, 368, 332, 328, 324, 648, 652, 656, 692, 688, 684, 720, 724, 728, 3644, 3640, 3636, 3600, 3604, 3608, 3572, 3568, 3564, 3240, 3244, 3248, 3284, 3280, 3276, 3312, 3316, 3320, 2996, 2992, 2988
Offset: 0

Views

Author

Antti Karttunen, Jul 29 2009

Keywords

Comments

It is easy to see by induction that these terms are always divisible by 4.

Crossrefs

Peano curve axes: A163480, A163481.

Programs

  • PARI
    a(n) = my(v=digits(n,3),s=Mod(0,2)); for(i=1,#v, if(s,v[i]=2-v[i]); s+=v[i]); fromdigits(v,9)<<2; \\ Kevin Ryde, Nov 06 2020

Formula

a(n) = 4*A163344(n).
a(n) = A163332(A338086(n)) = A338086(A128173(n)). - Kevin Ryde, Nov 06 2020

A342218 The n-th and a(n)-th points of the Peano curve (A163528, A163529) are symmetrical with respect to the line X=Y.

Original entry on oeis.org

0, 5, 6, 7, 4, 1, 2, 3, 8, 45, 50, 51, 52, 49, 46, 47, 48, 53, 54, 59, 60, 61, 58, 55, 56, 57, 62, 63, 68, 69, 70, 67, 64, 65, 66, 71, 36, 41, 42, 43, 40, 37, 38, 39, 44, 9, 14, 15, 16, 13, 10, 11, 12, 17, 18, 23, 24, 25, 22, 19, 20, 21, 26, 27, 32, 33, 34, 31
Offset: 0

Views

Author

Rémy Sigrist, Mar 05 2021

Keywords

Comments

In other words, a(n) is the unique k such that A163528(n) = A163529(k) and A163528(k) = A163529(n).
This sequence is a self-inverse permutation of the nonnegative integers.

Examples

			The Peano curve (A163528, A163529) begins as follows:
       +-----+-----+
       |6     7     8
       |
       +-----+-----+
        5     4    |3
                   |
       +-----+-----+
        0     1     2
- so a(0) = 0,
     a(1) = 5,
     a(2) = 6,
     a(3) = 7,
     a(4) = 4,
     a(8) = 8.
		

Crossrefs

See A342217 and A342224 for similar sequences.

Programs

  • PARI
    See Links section.
    
  • PARI
    my(table=[0,5,6,7,4,1,2,3,8]); a(n) = fromdigits(apply(d->table[d+1], digits(n,9)), 9); \\ Kevin Ryde, Mar 07 2021

Formula

a(n) = n iff n belongs to A338086.
a(n) < 9^k for any n < 9^k.
Showing 1-6 of 6 results.