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

A053754 If k is in the sequence then 2*k and 2*k+1 are not (and 0 is in the sequence); when written in binary k has an even number of bits (0 has 0 digits).

Original entry on oeis.org

0, 2, 3, 8, 9, 10, 11, 12, 13, 14, 15, 32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, 45, 46, 47, 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 58, 59, 60, 61, 62, 63, 128, 129, 130, 131, 132, 133, 134, 135, 136, 137, 138, 139, 140, 141, 142, 143, 144, 145, 146, 147, 148
Offset: 1

Views

Author

Henry Bottomley, Apr 06 2000

Keywords

Comments

Runs of successive terms with same number of bits have length twice powers of 4 (A081294). [Clarified by Michel Marcus, Oct 21 2020]
The sequence A081294 counts compositions of even numbers - Gus Wiseman, Aug 12 2021
A031443 is a subsequence; A179888 is the intersection of this sequence and A032925. - Reinhard Zumkeller, Jul 31 2010
The lower and upper asymptotic densities of this sequence are 1/3 and 2/3, respectively. - Amiram Eldar, Feb 01 2021
From Gus Wiseman, Aug 10 2021: (Start)
Also numbers k such that the k-th composition in standard order (row k of A066099) has even sum. The terms and corresponding compositions begin:
0: () 2: (2) 8: (4)
3: (1,1) 9: (3,1)
10: (2,2)
11: (2,1,1)
12: (1,3)
13: (1,2,1)
14: (1,1,2)
15: (1,1,1,1)
The following pertain to compositions in standard order: A000120, A029837, A070939, A066099, A124767.
(End)

Crossrefs

Positions of even terms in A029837 with offset 0.
The complement (the odd version) is A053738, counted by A000302.
The version for Heinz numbers of partitions is A300061, counted by A058696.

Programs

  • Haskell
    a053754 n = a053754_list !! (n-1)
    a053754_list = 0 : filter (even . a070939) [1..]
    -- Reinhard Zumkeller, Apr 18 2015
    
  • Mathematica
    Select[Range[0, 150], EvenQ @ IntegerLength[#, 2] &] (* Amiram Eldar, Feb 01 2021 *)
  • PARI
    lista(nn) = {my(va = vector(nn)); for (n=2, nn, my(k=va[n-1]+1); while (#select(x->(x==k\2), va), k++); va[n] = k;); va;} \\ Michel Marcus, Oct 20 2020
    
  • PARI
    a(n) = n-1 + (1<Kevin Ryde, Apr 30 2021

Extensions

Offset corrected by Reinhard Zumkeller, Jul 30 2010

A023717 Numbers with no 3's in base-4 expansion.

Original entry on oeis.org

0, 1, 2, 4, 5, 6, 8, 9, 10, 16, 17, 18, 20, 21, 22, 24, 25, 26, 32, 33, 34, 36, 37, 38, 40, 41, 42, 64, 65, 66, 68, 69, 70, 72, 73, 74, 80, 81, 82, 84, 85, 86, 88, 89, 90, 96, 97, 98, 100, 101, 102, 104, 105, 106, 128, 129, 130, 132, 133, 134, 136, 137, 138
Offset: 0

Views

Author

Keywords

Comments

A032925 is the intersection of this sequence and A023705; cf. A179888. - Reinhard Zumkeller, Jul 31 2010
Fixed point of the morphism: 0-> 0,1,2; 1-> 4,5,6; 2-> 8,9,10; ...; n-> 4n,4n+1,4n+2. - Philippe Deléham, Oct 22 2011

Crossrefs

Programs

  • C
    uint32_t a_next(uint32_t a_n) {
        uint32_t t = ((a_n ^ 0xaaaaaaaa) | 0x55555555) >> 1;
        return (a_n - t) & t;
    } // Falk Hüffner, Jan 22 2022
    
  • Haskell
    a023717 n = a023717_list !! (n-1)
    a023717_list = filter f [0..] where
       f x = x < 3 || (q < 3 && f x') where (x', q) = divMod x 4
    -- Reinhard Zumkeller, Apr 18 2015
    
  • Julia
    function a(n)
        m, r, b = n, 0, 1
        while m > 0
            m, q = divrem(m, 3)
            r += b * q
            b *= 4
        end
    r end; [a(n) for n in 0:58] |> println # Peter Luschny, Jan 03 2021
    
  • Mathematica
    Select[ Range[ 0, 140 ], (Count[ IntegerDigits[ #, 4 ], 3 ]==0)& ]
  • PARI
    a(n)=if(n<1,0,if(n%3,a(n-1)+1,4*a(n/3)))
    
  • PARI
    a(n)=if(n<1,0,4*a(floor(n/3))+n-3*floor(n/3))
    
  • Python
    from gmpy2 import digits
    def A023717(n): return int(digits(n,3),4) # Chai Wah Wu, May 06 2025

Formula

a(n) = Sum_{i=0..m} d(i)*4^i, where Sum_{i=0..m} d(i)*3^i is the base-3 representation of n. - Clark Kimberling
a(3n) = 4*a(n); a(3n+1) = 4*a(n)+1; a(3n+2) = 4*a(n)+2; a(n) = 4*a(floor(n/3)) + n - 3*floor(n/3). - Benoit Cloitre, Apr 27 2003
a(n) = Sum_{k>=0} A030341(n,k)*4^k. - Philippe Deléham, Oct 22 2011

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

A147992 Sequence S such that 1 is in S and if x is in S, then 4x-1 and 4x+1 are in S.

Original entry on oeis.org

1, 3, 5, 11, 13, 19, 21, 43, 45, 51, 53, 75, 77, 83, 85, 171, 173, 179, 181, 203, 205, 211, 213, 299, 301, 307, 309, 331, 333, 339, 341, 683, 685, 691, 693, 715, 717, 723, 725, 811, 813, 819, 821, 843, 845, 851, 853, 1195, 1197, 1203, 1205, 1227, 1229, 1235
Offset: 1

Views

Author

Clark Kimberling, Dec 07 2008

Keywords

Comments

Does every generation after the initial 1 contain a prime?

Examples

			0th generation: 1
1st generation: 3 5
2nd generation: 11 13 19 21
		

Crossrefs

Cf. A032925.
Column k=4 of A360099.

Formula

Product_{j=0..n-1} cos(4^j) = 2^(-n+1)*Sum_{i=2^(n-1)..2^n-1} cos(a(i)). - Gevorg Hmayakyan, Jan 15 2017
Sum_{i=2^(n-1)..2^n-1} cos(a(i)/4^(n-1)*Pi/2) = 0. - Gevorg Hmayakyan, Jan 15 2017
a(n) = 2*A032925(n-1) + 1 for n>=2. - Alois P. Heinz, Jan 29 2023

A179888 Starting with a(1)=2: if m is a term then also 4*m+1 and 4*m+2.

Original entry on oeis.org

2, 9, 10, 37, 38, 41, 42, 149, 150, 153, 154, 165, 166, 169, 170, 597, 598, 601, 602, 613, 614, 617, 618, 661, 662, 665, 666, 677, 678, 681, 682, 2389, 2390, 2393, 2394, 2405, 2406, 2409, 2410, 2453, 2454, 2457, 2458, 2469, 2470, 2473, 2474, 2645, 2646, 2649
Offset: 1

Views

Author

Reinhard Zumkeller, Jul 31 2010

Keywords

Comments

0 -> 01 and 1 -> 10 in binary representation of n;
intersection of A032925 and A053754;
subsequence of A063037;
A000120(a(n))=A023416(a(n))=A070939(n); A070939(a(n))=2*A070939(n).

Examples

			__ n | __ bin(n) || ___ bin(a(n)) | base-4(a(n)) | __ a(n)
-----|-----------||---------------|--------------|---------
.. 1 | ....... 1 || .......... 10 | .......... 2 | ..... 2;
.. 2 | ...... 10 || ........ 1001 | ......... 21 | ..... 9;
.. 3 | ...... 11 || ........ 1010 | ......... 22 | .... 10;
.. 4 | ..... 100 || ...... 100101 | ........ 211 | .... 37;
.. 5 | ..... 101 || ...... 100110 | ........ 212 | .... 38;
.. 6 | ..... 110 || ...... 101001 | ........ 221 | .... 41;
.. 7 | ..... 111 || ...... 101010 | ........ 222 | .... 42;
.. 8 | .... 1000 || .... 10010101 | ....... 2111 | ... 149;
.. 9 | .... 1001 || .... 10010110 | ....... 2112 | ... 150;
. 10 | .... 1010 || .... 10011001 | ....... 2121 | ... 153;
. 11 | .... 1011 || .... 10011010 | ....... 2122 | ... 154;
. 12 | .... 1100 || .... 10100101 | ....... 2211 | ... 165;
. 13 | .... 1101 || .... 10100110 | ....... 2212 | ... 166;
. 14 | .... 1110 || .... 10101001 | ....... 2221 | ... 169;
. 15 | .... 1111 || .... 10101010 | ....... 2222 | ... 170;
. 16 | ... 10000 || .. 1001010101 | ...... 21111 | ... 597;
. 17 | ... 10001 || .. 1001010110 | ...... 21112 | ... 598;
. 18 | ... 10010 || .. 1001011001 | ...... 21121 | ... 601;
. 19 | ... 10011 || .. 1001011010 | ...... 21122 | ... 602;
. 20 | ... 10100 || .. 1001100101 | ...... 21211 | ... 613.
		

Crossrefs

Programs

  • Haskell
    a179888 n = a179888_list !! (n-1)
    a179888_list = 2 : f a179888_list where
      f (x:xs) = x' : x'' : f (xs ++ [x',x'']) where x' = 4*x+1; x'' = x' + 1
    -- Reinhard Zumkeller, Oct 29 2011
    
  • Maple
    a:= n-> 1+(n mod 2)+`if`(n<2, 0, 4*a(iquo(n, 2))):
    seq(a(n), n=1..50);  # Alois P. Heinz, Jul 15 2024
  • Mathematica
    Union@ Flatten@ NestList[ {4 # + 1, 4 # + 2} &, 2, 5] (* Robert G. Wilson v, Aug 16 2011 *)
  • Python
    def A179888(n): return ((1<<(n.bit_length()<<1))-1)//3+int(bin(n)[2:],4) # Chai Wah Wu, Jul 16 2024

Formula

a(n) = 4*a(floor(n/2)) + n mod 2 + 1 for n>1;
a(n) = SUM((bit(k)+1)*4^k: 0<=k<=L), where bit() and L such that n=SUM(bit(k)*2^k: 0<=k<=L).

A115716 A divide-and-conquer sequence.

Original entry on oeis.org

1, 1, 3, 1, 3, 1, 11, 1, 3, 1, 11, 1, 3, 1, 43, 1, 3, 1, 11, 1, 3, 1, 43, 1, 3, 1, 11, 1, 3, 1, 171, 1, 3, 1, 11, 1, 3, 1, 43, 1, 3, 1, 11, 1, 3, 1, 171, 1, 3, 1, 11, 1, 3, 1, 43, 1, 3, 1, 11, 1, 3, 1, 683, 1, 3, 1, 11, 1, 3, 1, 43, 1, 3, 1, 11, 1, 3, 1, 171, 1, 3, 1, 11, 1, 3, 1, 43, 1, 3, 1, 11, 1
Offset: 0

Views

Author

Paul Barry, Jan 29 2006

Keywords

Examples

			G.f. = 1 + x + 3*x^2 + x^3 + 3*x^4 + x^5 + 11*x^6 + x^7 + 3*x^8 + x^9 + ...
		

Crossrefs

Partial sums are A032925.
Row sums of number triangle A115717.
Bisection: A276390.
See A276391 for a closely related sequence.

Programs

  • Maple
    a:= proc(n) option remember; `if`(n=0, 1,
          `if`(n::odd, 1, 4*a(n/2-1)-1))
        end:
    seq(a(n), n=0..100);  # Alois P. Heinz, Sep 07 2016
  • Mathematica
    a[n_] := a[n] = If[n == 0, 1, If[OddQ[n], 1, 4*a[n/2-1]-1]]; Table[a[n], {n, 0, 100}] (* Jean-François Alcover, Jan 25 2017, after Alois P. Heinz *)
  • PARI
    {a(n) = if( n<1, n==0, n%2, 1, 4 * a(n/2-1) - 1)}; /* Michael Somos, Sep 07 2016 */

Formula

The g.f. G(x) satisfies G(x)-4*x^2*G(x^2)=(1+2*x)/(1+x). - Argument and offset corrected by Bill Gosper, Sep 07 2016
G.f.: 1/(1-x) + Sum_{k>=0} ((4^k-0^k)/2) *x^(2^(k+1)-2) /(1-x^(2^k)). - corrected by R. J. Mathar, Sep 07 2016
a(n)=A007583(A091090(n+1)-1). - Adapted to new offset by R. J. Mathar, Sep 07 2016
a(0) = 1, a(2*n + 1) = 1 for n>=0. a(2*n + 2) = 4*a(n) - 1 for n>=0. - Michael Somos, Sep 07 2016

A115715 A divide-and-conquer triangle.

Original entry on oeis.org

1, 1, 1, 4, 0, 1, 4, 0, 1, 1, 4, 4, 0, 0, 1, 4, 4, 0, 0, 1, 1, 16, 0, 4, 0, 0, 0, 1, 16, 0, 4, 0, 0, 0, 1, 1, 16, 0, 4, 4, 0, 0, 0, 0, 1, 16, 0, 4, 4, 0, 0, 0, 0, 1, 1, 16, 16, 0, 0, 4, 0, 0, 0, 0, 0, 1, 16, 16, 0, 0, 4, 0, 0, 0, 0, 0, 1, 1, 16, 16, 0, 0, 4, 4, 0, 0, 0, 0, 0, 0, 1, 16, 16, 0, 0, 4, 4, 0, 0, 0, 0, 0, 0, 1, 1
Offset: 0

Views

Author

Paul Barry, Jan 29 2006

Keywords

Examples

			Triangle begins
   1;
   1,  1;
   4,  0,  1;
   4,  0,  1,  1;
   4,  4,  0,  0,  1;
   4,  4,  0,  0,  1,  1;
  16,  0,  4,  0,  0,  0,  1;
  16,  0,  4,  0,  0,  0,  1,  1;
  16,  0,  4,  4,  0,  0,  0,  0,  1;
  16,  0,  4,  4,  0,  0,  0,  0,  1,  1;
  16, 16,  0,  0,  4,  0,  0,  0,  0,  0,  1;
  16, 16,  0,  0,  4,  0,  0,  0,  0,  0,  1,  1;
  16, 16,  0,  0,  4,  4,  0,  0,  0,  0,  0,  0,  1;
  16, 16,  0,  0,  4,  4,  0,  0,  0,  0,  0,  0,  1,  1;
  64,  0, 16,  0,  0,  0,  4,  0,  0,  0,  0,  0,  0,  0,  1;
  64,  0, 16,  0,  0,  0,  4,  0,  0,  0,  0,  0,  0,  0,  1,  1;
  64,  0, 16,  0,  0,  0,  4,  4,  0,  0,  0,  0,  0,  0,  0,  0,  1;
		

Crossrefs

Cf. A032925 (row sums), A115639 (first column), A115713 (inverse).

Programs

  • Maple
    A115715 := proc(n,k)
        option remember;
        if n = k then
            1;
        elif k > n then
            0;
        else
            -add(procname(n,l)*A115713(l,k),l=k+1..n) ;
        end if;
    end proc:
    seq(seq(A115715(n,k),k=0..n),n=0..13) ; # R. J. Mathar, Sep 07 2016
  • Mathematica
    A115713[n_, k_]:= If[k==n, 1, If[k==n-1, ((-1)^n-1)/2, If[n==2*k+2, -4, 0]]];
    T[n_, k_]:= T[n, k]= If[k==n, 1, -Sum[T[n, j]*A115713[j, k], {j, k+1, n}]];
    Table[T[n, k], {n,0,18}, {k,0,n}]//Flatten (* G. C. Greubel, Nov 23 2021 *)
  • Sage
    @CachedFunction
    def A115713(n,k):
        if (k==n): return 1
        elif (k==n-1): return -(n%2)
        elif (n==2*k+2): return -4
        else: return 0
    def A115715(n,k):
        if (k==0): return 4^(floor(log(n+2, 2)) -1)
        elif (k==n): return 1
        elif (k==n-1): return (n%2)
        else: return (-1)*sum( A115715(n,j)*A115713(j,k) for j in (k+1..n) )
    flatten([[A115715(n,k) for k in (0..n)] for n in (0..18)]) # G. C. Greubel, Nov 23 2021

Formula

Sum_{=0..n} T(n, k) = A032925(n).
T(n, 0) = A115639(n).
T(n, k) = 1 if n = k, otherwise T(n, k) = (-1)*Sum_{j=k+1..n} T(n, j)*A115713(j, k). - R. J. Mathar, Sep 07 2016

A255264 Total number of ON cells in the "Ulam-Warburton" two-dimensional cellular automaton of A147562 after A048645(n) generations.

Original entry on oeis.org

1, 5, 9, 21, 25, 37, 85, 89, 101, 149, 341, 345, 357, 405, 597, 1365, 1369, 1381, 1429, 1621, 2389, 5461, 5465, 5477, 5525, 5717, 6485, 9557, 21845, 21849, 21861, 21909, 22101, 22869, 25941, 38229, 87381, 87385, 87397, 87445, 87637
Offset: 1

Views

Author

Omar E. Pol, Feb 19 2015

Keywords

Comments

It appears that these are the terms of A147562, A162795, A169707, A255366, A256250, A256260, whose indices have binary weight 1 or 2.

Examples

			Also, written as an irregular triangle in which row lengths are the terms of A028310 the sequence begins:
      1;
      5;
      9,    21;
     25,    37,    85;
     89,   101,   149,   341;
    345,   357,   405,   597,  1365;
   1369,  1381,  1429,  1621,  2389,  5461;
   5465,  5477,  5525,  5717,  6485,  9557, 21845;
  21849, 21861, 21909, 22101, 22869, 25941, 38229, 87381;
  ...
Right border gives the positive terms of A002450.
It appears that the second leading diagonal gives the odd terms of A206374.
		

Crossrefs

Formula

a(n) = A147562(A048645(n)).
Conjecture 1: a(n) = A162795(A048645(n)).
Conjecture 2: a(n) = A169707(A048645(n)).
Conjecture 3: a(n) = A255366(A048645(n)).
Conjecture 4: a(n) = A256250(A048645(n)).
Conjecture 5: a(n) = A256260(A048645(n)).
a(n) = A032925(A209492(n-1)) (conjectured). - Jon Maiga, Dec 17 2021

A343049 The k-th binary digit of a(n) is the most frequent digit among the first k binary digits of n (in case of a tie, take the k-th binary digit of n).

Original entry on oeis.org

0, 1, 2, 7, 0, 5, 6, 31, 0, 9, 10, 31, 8, 29, 30, 127, 0, 1, 2, 23, 0, 21, 22, 127, 0, 25, 26, 127, 24, 125, 126, 511, 0, 1, 2, 39, 0, 37, 38, 127, 0, 41, 42, 127, 40, 125, 126, 511, 0, 33, 34, 119, 32, 117, 118, 511, 32, 121, 122, 511, 120, 509, 510, 2047, 0
Offset: 0

Views

Author

Rémy Sigrist, Apr 09 2021

Keywords

Comments

Leading zeros are taken into account up to the point the number of zeros exceeds the total number of ones.
We scan the binary representation of a number starting from the least significant digit. See A343271 for the other way.

Examples

			The first terms, in decimal and in binary, are:
  n   a(n)  bin(n)  bin(a(n))
  --  ----  ------  ---------
   0     0       0          0
   1     1       1          1
   2     2      10         10
   3     7      11        111
   4     0     100          0
   5     5     101        101
   6     6     110        110
   7    31     111      11111
   8     0    1000          0
   9     9    1001       1001
  10    10    1010       1010
  11    31    1011      11111
  12     8    1100       1000
  13    29    1101      11101
  14    30    1110      11110
  15   127    1111    1111111
		

Crossrefs

Programs

  • PARI
    a(n, base=2) = { my (d=digits(n, base), t, f=vector(base)); d=concat(vector(#d), d); forstep (k=#d, 1, -1, f[1+d[k]]++; if (vecmax(f)==f[1+d[k]], t=d[k];); d[k]=t); fromdigits(d, base) }

Formula

a(n) = 0 iff n belongs to A036993.
a(n) = n iff n = 0 or n belongs to A032925.
a(2^k-1) = 2^(2*k-1)-1 for any k > 1.
A070939(a(n)) < 2*A070939(n).
Showing 1-9 of 9 results.