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

A348166 a(n) = abs(A020338(n)-A338754(n)).

Original entry on oeis.org

0, 0, 0, 0, 0, 0, 0, 0, 0, 90, 0, 90, 180, 270, 360, 450, 540, 630, 720, 180, 90, 0, 90, 180, 270, 360, 450, 540, 630, 270, 180, 90, 0, 90, 180, 270, 360, 450, 540, 360, 270, 180, 90, 0, 90, 180, 270, 360, 450, 450, 360, 270, 180, 90, 0, 90, 180, 270, 360, 540, 450, 360, 270, 180, 90, 0, 90, 180, 270, 630, 540, 450, 360, 270, 180, 90
Offset: 1

Views

Author

Nicolas Bělohoubek, Oct 04 2021

Keywords

Comments

All terms are multiples of 90.

Examples

			a(1) = abs(11-11) = 0
a(15) = abs(1515-1155) = 360
a(1965) = abs(19651965-11996655) = 7655310
		

Crossrefs

Programs

Formula

a(A010785(n)) = 0

Extensions

Corrected by Charles R Greathouse IV, Oct 04 2021

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

A051022 Interpolate 0's between each pair of digits of n.

Original entry on oeis.org

0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 100, 101, 102, 103, 104, 105, 106, 107, 108, 109, 200, 201, 202, 203, 204, 205, 206, 207, 208, 209, 300, 301, 302, 303, 304, 305, 306, 307, 308, 309, 400, 401, 402, 403, 404, 405, 406, 407, 408, 409, 500, 501, 502, 503, 504, 505
Offset: 0

Views

Author

Eric W. Weisstein, Dec 11 1999

Keywords

Comments

These numbers have the same decimal and negadecimal representations.
Or fixed points of decimal negadecimal conversion. - Gerald Hillier, Apr 23 2015

Examples

			a(23) = 203.
a(99) = 909.
a(100) = 10000.
a(101) = 10001.
a(111) = 10101.
		

Crossrefs

Cf. A039723, A063010, A092908 (primes), A092909 (on primes), A338754 (*11).
In other bases: A000695, A037314, A276089.

Programs

  • Haskell
    a051022 n = if n < 10 then n else a051022 n' * 100 + r
                where (n', r) = divMod n 10
    -- Reinhard Zumkeller, Apr 20 2011
    (HP 49G calculator)
    « "" + SREV 0 9
      FOR i i "" + DUP 0 + SREPL DROP
      NEXT SREV OBJ->
    ». Gerald Hillier, Apr 23 2015
    
  • Maple
    M:= 3: # to get a(0) to a(10^M-1)
    A:= 0:
    for d from 1 to M do
      A:= seq(seq(a*100+b,b=0..9),a=A);
    od:
    A; # Robert Israel, Apr 23 2015
  • Mathematica
    Table[FromDigits[Riffle[IntegerDigits[n],0]],{n,0,60}] (* Harvey P. Dale, Nov 17 2013 *)
    ToNegaBases[i_Integer, b_Integer] := FromDigits[ Rest[ Reverse[ Mod[ NestWhileList[(#1 - Mod[ #1, b])/-b &, i, #1 != 0 &], b]]]];
    k = 0; lst = {}; While[k < 1001, If[k == ToNegaBases[k, 10], AppendTo[ lst, k]]; k++]; lst (* Robert G. Wilson v, Jun 11 2014 *)
  • PARI
    a(n) = fromdigits(digits(n),100); \\ Kevin Ryde, Nov 07 2020
    
  • Python
    def a(n): return int("0".join(str(n)))
    print([a(n) for n in range(56)]) # Michael S. Branicky, Aug 15 2022

Formula

Sums a_i*100^e_i with 0 <= a_i < 10.
a(n) = n if n < 10, otherwise a(floor(n/10))*100 + n mod 10. - Reinhard Zumkeller, Apr 20 2011 [Corrected by Kevin Ryde, Nov 07 2020]
a(n) = A338754(n)/11. - Kritsada Moomuang, Oct 20 2019 [Corrected by Kevin Ryde, Nov 07 2020]

Extensions

More terms and more precise definition from Jorge Coveiro, Apr 15 2004 and David Wasserman, Feb 26 2008
Edited by N. J. A. Sloane, Sep 14 2008 at the suggestion of R. J. Mathar
Offset fixed by Reinhard Zumkeller, Apr 20 2012

A338086 Duplicate the ternary digits of n, so each 0, 1 or 2 becomes 00, 11 or 22 respectively.

Original entry on oeis.org

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

Views

Author

Kevin Ryde, Oct 09 2020

Keywords

Comments

Also, numbers whose ternary digit runs are all even lengths (including 0 reckoned as no digits at all). Also, change ternary digits 0,1,2 to base 9 digits 0,4,8, and hence numbers which can be written in base 9 using only digits 0,4,8.
Digit duplication 00,11,22 can be compared to A037314 which is 0 above each so 00,01,02, or A208665 which is 0 below each so 00,10,20. Duplication is the sum of these, or any one is a suitable multiple of another (*3, *4, etc).
This sequence is the points on the X=Y diagonal of the ternary Z-order curve (see example table in A163328). The Z-order curve takes a point number p and splits its ternary digits alternately to X and Y coordinates so X(p) = A163325(p) and Y(p) = A163326(p). Duplicate digits in a(n) are the diagonal X(a(n)) = Y(a(n)) = n.

Examples

			n=73 is ternary 2201 which duplicates to 22220011 ternary = 8804 base 9 = 6484 decimal.
		

Crossrefs

Cf. A020331 (ternary concatenation).
Digit duplication in other bases: A001196, A338754.

Programs

  • PARI
    a(n) = fromdigits(digits(n,3),9)<<2;
    
  • Python
    from gmpy2 import digits
    def A338086(n): return int(''.join(d*2 for d in digits(n,3)),3) # Chai Wah Wu, May 07 2022

Formula

a(n) = A037314(n) + A208665(n) = 4*A037314(n) = (4/3)*A208665(n).
a(n) = 4*Sum_{i=0..k} d[i]*9^i where the ternary expansion of n is n = Sum_{i=0..k} d[i]*3^i with digits d[i]=0,1,2.

A044836 Positive integers having more base-10 runs of even length than odd.

Original entry on oeis.org

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
Offset: 1

Views

Author

Keywords

Crossrefs

Number of even/odd runs: A044941, A044950. Cf. A044851 (no fewer), A044866 (same number).
Cf. A044828 (binary analog), A338754.

Programs

  • PARI
    is(n,base=10) = { my (v=0); while (n, my (d=n%base, w=0); while (n%base==d, n\=base; w++); v+=(-1)^w); v>0 } \\ Rémy Sigrist, Nov 07 2020

Extensions

Incorrect formula removed by Rémy Sigrist, Nov 07 2020

A352535 Numbers m such that A257588(m) = 0.

Original entry on oeis.org

0, 11, 22, 33, 44, 55, 66, 77, 88, 99, 110, 220, 330, 354, 440, 453, 550, 660, 770, 880, 990, 1001, 1100, 1111, 1122, 1133, 1144, 1155, 1166, 1177, 1188, 1199, 1221, 1331, 1441, 1487, 1551, 1575, 1661, 1771, 1784, 1881, 1991, 2002, 2112, 2200, 2211, 2222, 2233, 2244, 2255, 2266, 2277
Offset: 1

Views

Author

Bernard Schott, Mar 20 2022

Keywords

Comments

If m is a term, 10*m is also a term; so, terms with no trailing zeros are all primitive terms.
Palindromes with even number of digits (A056524) are all terms.

Examples

			354 is a term since 3^2 - 5^2 + 4^2 = 0 (with Pythagorean triple (3,4,5)).
1487 is a term since 1^2 - 4^2 + 8^2 - 7^2 = 0.
		

Crossrefs

Subsequences: A056524, A333440, A338754.

Programs

  • Mathematica
    f[n_] := Abs @ Total[(d = IntegerDigits[n]^2) * (-1)^Range[Length[d]]]; Select[Range[0, 2300], f[#] == 0 &] (* Amiram Eldar, Mar 20 2022 *)
  • Python
    from itertools import count, islice
    def A352535_gen(startvalue=0): # generator of terms >= startvalue
        return filter(lambda m: not sum(int(d)**2*(-1 if i % 2 else 1) for i, d in enumerate(str(m))), count(max(startvalue,0)))
    A352535_list = list(islice(A352535_gen(),30)) # Chai Wah Wu, Mar 24 2022

Formula

A257588(a(n)) = 0.

A248126 a(n) = n^2 with each digit repeated.

Original entry on oeis.org

11, 44, 99, 1166, 2255, 3366, 4499, 6644, 8811, 110000, 112211, 114444, 116699, 119966, 222255, 225566, 228899, 332244, 336611, 440000, 444411, 448844, 552299, 557766, 662255, 667766, 772299, 778844, 884411, 990000, 996611, 11002244, 11008899, 11115566
Offset: 1

Views

Author

Jon Perry, Nov 01 2014

Keywords

Comments

Inspired by A116699.

Examples

			13^2 = 169, so a(13) = 116699.
		

Crossrefs

Programs

  • JavaScript
    for (i=1;i<40;i++) {
    s=(i*i).toString();
    for (j=0;j
    				
  • Mathematica
    a248126[n_Integer] :=
    Module[{m}, m := IntegerDigits[n^2];
      FromDigits[Flatten[Transpose[List[m, m]]]]]; a248126 /@ Range[34] (* Michael De Vlieger, Nov 06 2014 *)
    Table[FromDigits[Riffle[id=IntegerDigits[n^2],id]],{n,40}] (* Harvey P. Dale, Dec 19 2015 *)
  • PARI
    a(n)= my(d = 11*digits(n^2)); fromdigits(d, 100) \\ David A. Corneth, Dec 02 2023
    
  • Python
    def a(n): return int("".join(d*2 for d in str(n**2)))
    print([a(n) for n in range(1, 35)]) # Michael S. Branicky, Dec 02 2023
Showing 1-7 of 7 results.