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.

Previous Showing 11-20 of 321 results. Next

A001743 Numbers in which every digit contains at least one loop (version 1).

Original entry on oeis.org

0, 6, 8, 9, 60, 66, 68, 69, 80, 86, 88, 89, 90, 96, 98, 99, 600, 606, 608, 609, 660, 666, 668, 669, 680, 686, 688, 689, 690, 696, 698, 699, 800, 806, 808, 809, 860, 866, 868, 869, 880, 886, 888, 889, 890, 896, 898, 899, 900, 906, 908, 909, 960, 966, 968, 969
Offset: 1

Views

Author

Keywords

Comments

See A001744 for the other version.
If n-1 is represented as a base-4 number (see A007090) according to n-1 = d(m)d(m-1)...d(3)d(2)d(1)d(0) then a(n) = Sum_{j=0..m} c(d(j))*10^j, where c(k)=0,6,8,9 for k=0..3. - Hieronymus Fischer, May 30 2012

Examples

			a(1000) = 99896.
a(10^4) = 8690099.
a(10^5) = 680688699.
		

Crossrefs

Programs

  • Mathematica
    Union[Flatten[Table[FromDigits/@Tuples[{0,6,8,9},n],{n,3}]]] (* Harvey P. Dale, Sep 04 2013 *)
  • PARI
    is(n) = #setintersect(vecsort(digits(n), , 8), [1, 2, 3, 4, 5, 7])==0 \\ Felix Fröhlich, Sep 09 2019

Formula

From Hieronymus Fischer, May 30 2012: (Start)
a(n) = ((b_m(n)+6) mod 9 + floor((b_m(n)+2)/3) - floor(b_m(n)/3))*10^m + Sum_{j=0..m-1} (b_j(n) mod 4 +5*floor((b_j(n)+3)/4) +floor((b_j(n)+2)/4)- 6*floor(b_j(n)/4)))*10^j, where n>1, b_j(n)) = floor((n-1-4^m)/4^j), m = floor(log_4(n-1)).
a(1*4^n+1) = 6*10^n.
a(2*4^n+1) = 8*10^n.
a(3*4^n+1) = 9*10^n.
a(n) = 6*10^log_4(n-1) for n=4^k+1,
a(n) < 6*10^log_4(n-1), otherwise.
a(n) > 10^log_4(n-1) for n>1.
a(n) = 6*A007090(n-1), iff the digits of A007090(n-1) are 0 or 1.
G.f.: g(x) = (x/(1-x))*Sum_{j>=0} 10^j*x^4^j *(1-x^4^j)* (6 + 8x^4^j + 9(x^2)^4^j)/(1-x^4^(j+1)).
Also: g(x) = (x/(1-x))*(6*h_(4,1)(x) + 2*h_(4,2)(x) + h_(4,3)(x) - 9*h_(4,4)(x)), where h_(4,k)(x) = Sum_{j>=0} 10^j*(x^4^j)^k/(1-(x^4^j)^4). (End)

Extensions

Examples added by Hieronymus Fischer, May 30 2012

A030386 Triangle T(n,k): write n in base 4, reverse order of digits.

Original entry on oeis.org

0, 1, 2, 3, 0, 1, 1, 1, 2, 1, 3, 1, 0, 2, 1, 2, 2, 2, 3, 2, 0, 3, 1, 3, 2, 3, 3, 3, 0, 0, 1, 1, 0, 1, 2, 0, 1, 3, 0, 1, 0, 1, 1, 1, 1, 1, 2, 1, 1, 3, 1, 1, 0, 2, 1, 1, 2, 1, 2, 2, 1, 3, 2, 1, 0, 3, 1, 1, 3, 1, 2, 3, 1, 3, 3, 1, 0, 0, 2, 1, 0, 2, 2, 0, 2, 3, 0, 2, 0, 1, 2
Offset: 0

Views

Author

Keywords

Examples

			Triangle begins:
0
1
2
3
0, 1
1, 1
2, 1
3, 1
0, 2
1, 2
2, 2
3, 2
0, 3
1, 3
2, 3
3, 3
0, 0, 1
1, 0, 1 ... - _Philippe Deléham_, Oct 20 2011
		

Crossrefs

Cf. A030308, A030341, A031235, A030567, A031007, A031045, A031087, A031298 for the base-2 to base-10 analogs.
Cf. A007090.

Programs

  • Haskell
    a030386 n k = a030386_tabf !! n !! k
    a030386_row n = a030386_tabf !! n
    a030386_tabf = iterate succ [0] where
       succ []     = [1]
       succ (3:ts) = 0 : succ ts
       succ (t:ts) = (t + 1) : ts
    -- Reinhard Zumkeller, Sep 18 2015
  • Maple
    A030386_row := n -> op(convert(n, base, 4)):
    seq(A030386_row(n), n=0..36); # Peter Luschny, Nov 28 2017
  • Mathematica
    Flatten[Table[Reverse[IntegerDigits[n,4]],{n,0,50}]] (* Harvey P. Dale, Oct 13 2012 *)
  • PARI
    A030386(n, k=-1)=/*k<0&&error("Flattened sequence not yet implemented.")*/n\4^k%4 \\ Assuming that columns are numbered starting with k=0 as in A030308, A030341, ... \\ M. F. Hasler, Jul 21 2013
    

Extensions

Initial 0 and better name by Philippe Deléham, Oct 20 2011

A048647 Write n in base 4, then replace each digit '1' with '3' and vice versa and convert back to decimal.

Original entry on oeis.org

0, 3, 2, 1, 12, 15, 14, 13, 8, 11, 10, 9, 4, 7, 6, 5, 48, 51, 50, 49, 60, 63, 62, 61, 56, 59, 58, 57, 52, 55, 54, 53, 32, 35, 34, 33, 44, 47, 46, 45, 40, 43, 42, 41, 36, 39, 38, 37, 16, 19, 18, 17, 28, 31, 30, 29, 24, 27, 26, 25, 20, 23, 22, 21, 192, 195, 194, 193, 204, 207, 206
Offset: 0

Views

Author

John W. Layman, Jul 05 1999

Keywords

Comments

The graph of a(n) on [ 1..4^k ] resembles a plane fractal of fractal dimension 1.
Self-inverse considered as a permutation of the integers.
First 4^n terms of the sequence form a permutation s(n) of 0..4^n-1, n>=1; the number of inversions of s(n) is A115490(n). - Gheorghe Coserea, Apr 23 2018

Examples

			a(15)=5, since 15 = 33_4 -> 11_4 = 5.
		

Crossrefs

Column k=4 of A248813.

Programs

  • C
    uint32_t a(uint32_t n) { return n ^ ((n & 0x55555555) << 1); } // Falk Hüffner, Jan 22 2022
  • Haskell
    a048647 0 = 0
    a048647 n = 4 * a048647 n' + if m == 0 then 0 else 4 - m
                where (n', m) = divMod n 4
    -- Reinhard Zumkeller, Apr 08 2013
    
  • Maple
    f:= proc(n)
    option remember;
    local m, r;
    m:= n mod 4;
    r:= 4*procname((n-m)/4);
    if m = 0 then r else r + 4-m fi;
    end proc:
    f(0):= 0:
    seq(f(n),n=0..100); # Robert Israel, Nov 03 2014
    # second Maple program:
    a:= proc(n) option remember; `if`(n=0, 0,
          a(iquo(n, 4, 'r'))*4+[0, 3, 2, 1][r+1])
        end:
    seq(a(n), n=0..70);  # Alois P. Heinz, Jan 25 2022
  • Mathematica
    Table[FromDigits[If[#==0,0,4-#]&/@IntegerDigits[n,4],4],{n,0,70}] (* Harvey P. Dale, Jul 23 2012 *)
  • PARI
    a(n)=fromdigits(apply(d->if(d,4-d),digits(n,4)),4) \\ Charles R Greathouse IV, Jun 23 2017
    
  • Python
    from sympy.ntheory.factor_ import digits
    def a(n):
        return int("".join(str(4 - d) if d!=0 else '0' for d in digits(n, 4)[1:]), 4)
    print([a(n) for n in range(101)]) # Indranil Ghosh, Jun 26 2017
    
  • Python
    def A048647(n): return n^((n&((1<<(m:=n.bit_length())+(m&1))-1)//3)<<1) # Chai Wah Wu, Jan 29 2023
    

Formula

a(n) = if n = 0 then 0 else 4*a(floor(n/4)) + if m = 0 then 0 else 4 - m, where m = n mod 4. - Reinhard Zumkeller, Apr 08 2013
G.f. g(x) satisfies: g(x) = 4*(1+x+x^2+x^3)*g(x^4) + (3*x+2*x^2+x^3)/(1-x^4). - Robert Israel, Nov 03 2014

A007608 Nonnegative integers in base -4.

Original entry on oeis.org

0, 1, 2, 3, 130, 131, 132, 133, 120, 121, 122, 123, 110, 111, 112, 113, 100, 101, 102, 103, 230, 231, 232, 233, 220, 221, 222, 223, 210, 211, 212, 213, 200, 201, 202, 203, 330, 331, 332, 333, 320, 321, 322, 323, 310, 311, 312, 313, 300, 301, 302, 303, 13030
Offset: 0

Views

Author

Keywords

Comments

The base 2i representation (quater-imaginary representation) of nonnegative integers is obtained by interleaving with zeros, cf. A212494.
More precisely, a(n) is the number n written in base -4; numbers [which represent some nonnegative integer] in base -4 are 0, 1, 2, 3, 100, 101, 102, 103, 110, 111, 112, 113, 120, 121, 122, 123, 130, 131, 132, 133, ... (A212556) - M. F. Hasler, May 20 2012

References

  • D. E. Knuth, The Art of Computer Programming. Addison-Wesley, Reading, MA, 1969, Vol. 2, p. 189.
  • N. J. A. Sloane and Simon Plouffe, The Encyclopedia of Integer Sequences, Academic Press, 1995 (includes this sequence).

Crossrefs

Cf. A212556 (sorted), A066323 (sum of digits), A212526 (negative integers in base -4).

Programs

  • Haskell
    a007608 0 = 0
    a007608 n = a007608 n' * 10 + m where
       (n', m) = if r < 0 then (q + 1, r + 4) else (q, r)
                 where (q, r) = quotRem n (negate 4)
    -- Reinhard Zumkeller, Jul 15 2012
    
  • Mathematica
    ToNegaBases[i_Integer, b_Integer] := FromDigits[ Rest[ Reverse[ Mod[ NestWhileList[(#1 - Mod[ #1, b])/-b &, i, #1 != 0 &], b]]]]; Table[ ToNegaBases[n, 4], {n, 0, 55}]
  • PARI
    A007608(n,s="")={until(!n\=-4,s=Str(n%-4,s));eval(s)}  \\ M. F. Hasler, May 20 2012
    
  • Python
    def A007608(n):
        s, q = '', n
        while q >= 4 or q < 0:
            q, r = divmod(q, -4)
            if r < 0:
                q += 1
                r += 4
            s += str(r)
        return int(str(q)+s[::-1]) # Chai Wah Wu, Apr 09 2016

A100968 Integers that are Rhonda numbers to base 4.

Original entry on oeis.org

10206, 11935, 12150, 16031, 45030, 94185, 113022, 114415, 191149, 244713, 259753, 374782, 392121, 503773, 649902, 703326, 716250, 764526, 883630, 884446, 912766, 980694, 980837, 1005502, 1420250, 1474239, 1567335, 1685159, 1702822, 1824634, 1944190, 1948279
Offset: 1

Views

Author

Mark Hudson (mrmarkhudson(AT)hotmail.com), Nov 24 2004

Keywords

Comments

See sequence of base 10 Rhonda numbers for more information and links.

Examples

			10206 is a Rhonda number to base 4 because the product of its base 4 digits is 2*1*3*3*1*3*2=108, the sum of the prime factors of 10206 is 2+6*3+7=27 and 27*4=108.
From _Reinhard Zumkeller_, Mar 05 2015: (Start)
a(18) = 764526 = 2*4^9 + 3*4^8 + 2*4^7 + 2*4^6 + 2*4^5 + 2*4^4 + 1*4^3 + 2*4^2 + 3*4^1 + 2*4^0 = 2*3*7*109*167
with 2*3*2*2*2*2*1*2*3*2 = 4 * (2+3+7+109+167) = 1152;
a(21) = 912766 = 3*4^9 + 1*4^8 + 3*4^7 + 2*4^6 + 3*4^5 + 1*4^4 + 1*4^3 + 3*4^2 + 3*4^1 + 2*4^0 = 2*53*79*109
with 3*1*3*2*3*1*1*3*3*2 = 4 * (2+53+79+109) = 972.  (End)
		

Crossrefs

Rhonda numbers to other bases: A100969 (base 6), A100970 (base 8), A100973 (base 9), A099542 (base 10), A100971 (base 12), A100972 (base 14), A100974 (base 15), A100975 (base 16), A255735 (base 18), A255732 (base 20), A255736 (base 30), A255731 (base 60), see also A255872.
Cf. A001414, A027746, A007090, subsequence of A023705.
Column k=1 of A291925.

Programs

  • Haskell
    a100968 n = a100968_list !! (n-1)
    a100968_list = filter (rhonda 4) a023705_list
    -- Function rhonda as in A099542.
    -- Reinhard Zumkeller, Mar 08 2015
  • Mathematica
    A100968Q[k_] := Times @@ IntegerDigits[k, 4] == 4*Total[Times @@@ FactorInteger[k]];
    Select[Range[2000000], A100968Q] (* Paolo Xausa, Jul 01 2025 *)

Extensions

a(18) and a(21) corrected, terms a(24) - a(32) by Reinhard Zumkeller, Mar 05 2015

A023705 Numbers with no 0's in base-4 expansion.

Original entry on oeis.org

1, 2, 3, 5, 6, 7, 9, 10, 11, 13, 14, 15, 21, 22, 23, 25, 26, 27, 29, 30, 31, 37, 38, 39, 41, 42, 43, 45, 46, 47, 53, 54, 55, 57, 58, 59, 61, 62, 63, 85, 86, 87, 89, 90, 91, 93, 94, 95, 101, 102, 103, 105, 106, 107, 109, 110, 111, 117, 118, 119, 121, 122, 123
Offset: 1

Views

Author

Keywords

Comments

A032925 is the intersection of this sequence and A023717; cf. A179888. - Reinhard Zumkeller, Jul 31 2010

Crossrefs

Zeroless numbers in some other bases <= 10: A000042 (base 2), A032924 (base 3), A248910 (base 6), A255805 (base 8), A255808 (base 9), A052382 (base 10).
Cf. A100968 (subsequence).

Programs

  • C
    #include 
    uint32_t a_next(uint32_t a_n) { return (a_n + 1) | ((a_n & (a_n + 0xaaaaaaab)) >> 1); } /* Falk Hüffner, Jan 22 2022 */
    
  • Haskell
    a023705 n = a023705_list !! (n-1)
    a023705_list = iterate f 1 where
       f x = 1 + if r < 3 then x else 4 * f x'
             where (x', r) = divMod x 4
    -- Reinhard Zumkeller, Mar 06 2015, Oct 19 2011
    
  • Magma
    [n: n in [1..130] | not 0 in Intseq(n,4)]; // Vincenzo Librandi, Oct 04 2018
    
  • Maple
    R:= [1,2,3]: A:= 1,2,3:
    for i from 1 to 4 do
      R:= map(t -> (4*t+1,4*t+2,4*t+3), R);
      A:= A, op(R);
    od:
    A; # Robert Israel, Oct 04 2018
  • Mathematica
    Select[ Range[ 120 ], (Count[ IntegerDigits[ #, 4 ], 0 ]==0)& ]
    Select[Range[200],DigitCount[#,4,0]==0&] (* Harvey P. Dale, Dec 23 2015 *)
  • PARI
    isok(n) = vecmin(digits(n, 4)); \\ Michel Marcus, Jul 04 2015
    
  • Python
    from sympy import integer_log
    def A023705(n):
        m = integer_log(k:=(n<<1)+1,3)[0]
        return sum(1+(k-3**m)//(3**j<<1)%3<<(j<<1) for j in range(m)) # Chai Wah Wu, Jun 27 2025

Formula

G.f. g(x) satisfies g(x) = (x+2*x^2+3*x^3)/(1-x^3) + 4*(x+x^2+x^3)*g(x^3). - Robert Israel, Oct 04 2018

A029986 Numbers k such that k^2 is palindromic in base 4.

Original entry on oeis.org

0, 1, 5, 17, 21, 65, 71, 83, 257, 273, 281, 317, 1025, 1055, 4097, 4161, 4193, 4401, 5157, 5179, 5221, 16385, 16511, 16865, 17239, 65537, 65793, 65921, 66753, 68695, 69521, 69777, 80739, 82053, 82171, 82309, 82885, 83301, 262145
Offset: 1

Views

Author

Keywords

Crossrefs

Numbers k such that k^2 is palindromic in base b: A003166 (b=2), A029984 (b=3), this sequence (b=4), A029988 (b=5), A029990 (b=6), A029992 (b=7), A029805 (b=8), A029994 (b=9), A002778 (b=10), A029996 (b=11), A029737 (b=12), A029998 (b=13), A030072 (b=14), A030073 (b=15), A029733 (b=16), A118651 (b=17).

Programs

  • Mathematica
    Select[Range[0,300000],IntegerDigits[#^2,4]==Reverse[ IntegerDigits[ #^2,4]]&] (* Harvey P. Dale, Dec 01 2015 *)
  • PARI
    isok(k) = my(d=digits(k^2,4)); d == Vecrev(d); \\ Michel Marcus, Jul 04 2021

A255689 Convert n to base 4, move the most significant digit to the least significant one and convert back to base 10.

Original entry on oeis.org

0, 1, 2, 3, 1, 5, 9, 13, 2, 6, 10, 14, 3, 7, 11, 15, 1, 5, 9, 13, 17, 21, 25, 29, 33, 37, 41, 45, 49, 53, 57, 61, 2, 6, 10, 14, 18, 22, 26, 30, 34, 38, 42, 46, 50, 54, 58, 62, 3, 7, 11, 15, 19, 23, 27, 31, 35, 39, 43, 47, 51, 55, 59, 63, 1, 5, 9, 13, 17, 21, 25
Offset: 0

Views

Author

Paolo P. Lava, Mar 02 2015

Keywords

Comments

a(4*n) = 1.
Fixed points of the transform are listed in A048329.

Examples

			11 in base 4 is 23: moving the most significant digit as the least significant one we have 32 that is 14 in base 10.
		

Crossrefs

Programs

  • Maple
    with(numtheory): P:=proc(q,h) local a,b,k,n; print(0);
    for n from 1 to q do
    a:=convert(n,base,h); b:=[]; for k from 1 to nops(a)-1 do b:=[op(b),a[k]]; od; a:=[a[nops(a)],op(b)];
    a:=convert(a,base,h,10); b:=0; for k from nops(a) by -1 to 1 do b:=10*b+a[k]; od;
    print(b); od; end: P(10^4,4);
  • Mathematica
    roll[n_, b_] := Block[{w = IntegerDigits[n, b]}, Append[Rest@ w, First@ w]]; b = 4; FromDigits[#, b] & /@ (roll[#, b] & /@ Range[0, 70]) (* Michael De Vlieger, Mar 04 2015 *)
    Table[FromDigits[RotateLeft[IntegerDigits[n,4]],4],{n,0,70}] (* Harvey P. Dale, Aug 07 2015 *)
  • Python
    def A255689(n):
        x=A007090(n)
        return int (x[1:]+x[0],4) # Indranil Ghosh, Feb 08 2017

A110591 Number of digits in base-4 representation of n.

Original entry on oeis.org

1, 1, 1, 1, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4
Offset: 0

Views

Author

Jonathan Vos Post, Jul 29 2005

Keywords

Comments

Number of digits in A007090(n).
In terms of the repetition convolution operator #, where (sequence A) # (sequence B) = the sequence consisting of A(n) copies of B(n), this sequence is the repetition convolution A110594 # n. Over the set of positive infinite integer sequences, # gives a nonassociative noncommutative groupoid (magma) with a left identity (A000012) but no right identity, where the left identity is also a right nullifier and idempotent. For any positive integer constant c, the sequence c*A000012 = (c,c,c,c,...) is also a right nullifier; for c = 1, this is A000012; for c = 3 this is A010701.

Crossrefs

Programs

  • Haskell
    import Data.List (unfoldr)
    a110591 0 = 1
    a110591 n = length $
       unfoldr (\x -> if x == 0 then Nothing else Just (x, x `div` 4)) n
    -- Reinhard Zumkeller, Apr 22 2011
  • Maple
    A110592 := proc(n)
        if n = 0 then
            1;
        else
            1+floor(log[4](n)) ;
        end if;
    end proc:
    seq(A110592(n),n=0..50) ; # R. J. Mathar, Sep 02 2020
  • Mathematica
    a[n_] := If[n == 0, 1, Floor[Log[4, n]] + 1];
    a /@ Range[0, 100] (* Jean-François Alcover, Nov 24 2020 *)

Formula

G.f.: 1 + (1/(1 - x))*Sum_{k>=0} x^(4^k). - Ilya Gutkovskiy, Jan 08 2017
a(n) = floor(log_4(n)) + 1 for n >= 1. - Petros Hadjicostas, Dec 12 2019

A163241 Simple self-inverse permutation: Write n in base 4, then replace each digit '2' with '3' and vice versa, then convert back to decimal.

Original entry on oeis.org

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

Views

Author

Antti Karttunen, Jul 29 2009

Keywords

Examples

			43 in quaternary base (A007090) is written as '223' (2*16 + 2*4 + 3), which is then mapped to '332' = 3*16 + 3*4 + 2 = 62, thus a(43) = 62, and likewise a(62) = 43.
		

Crossrefs

Programs

  • C
    uint32_t a(uint32_t n) { return n ^ ((n >> 1) & 0x55555555); } // Falk Hüffner, Jan 22 2022
  • Maple
    a:= proc(n) option remember; `if`(n=0, 0,
          a(iquo(n, 4, 'r'))*4+[0, 1, 3, 2][r+1])
        end:
    seq(a(n), n=0..71);  # Alois P. Heinz, Jan 25 2022
  • Mathematica
    Table[FromDigits[IntegerDigits[n,4]/.{2->a,3->b}/.{a->3,b->2},4],{n,0,75}] (* Harvey P. Dale, Nov 29 2011 *)
  • PARI
    f(d) = if (d==2, 4, if (x==d, 2, d));
    a(n) = fromdigits(apply(f, digits(n, 4)), 4); \\ Michel Marcus, Jun 28 2017
    
  • Python
    def a000695(n):
        n=bin(n)[2:]
        x=len(n)
        return sum([int(n[i])*4**(x - 1 - i) for i in range(x)])
    def a059905(n): return sum([(n>>2*i&1)<Indranil Ghosh, Jun 26 2017
    
  • Scheme
    (define (A163241 n) (+ (A000695 (A003987bi (A059905 n) (A059906 n))) (* 2 (A000695 (A059906 n)))))
    

Formula

a(n) = A000695(A003987bi(A059905(n),A059906(n))) + 2*A000695(A059906(n)), where A003987bi is binary XOR.

Extensions

Edited by Charles R Greathouse IV, Nov 01 2009
Previous Showing 11-20 of 321 results. Next