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 28 results. Next

A325565 a(n) is the number of such divisors d of n that A048720(A065621(d),n/d) is equal to n.

Original entry on oeis.org

1, 2, 1, 3, 1, 2, 1, 4, 2, 2, 1, 3, 1, 2, 1, 5, 1, 4, 1, 3, 2, 2, 1, 4, 1, 2, 1, 3, 1, 2, 1, 6, 2, 2, 2, 6, 1, 2, 1, 4, 1, 4, 1, 3, 2, 2, 1, 5, 2, 2, 1, 3, 1, 2, 1, 4, 1, 2, 1, 3, 1, 2, 1, 7, 2, 4, 1, 3, 1, 4, 1, 8, 1, 2, 2, 3, 1, 2, 1, 5, 1, 2, 1, 6, 1, 2, 1, 4, 1, 4, 1, 3, 2, 2, 1, 6, 1, 4, 1, 3, 1, 2, 1, 4, 2
Offset: 1

Views

Author

Antti Karttunen, May 09 2019

Keywords

Comments

Equally, a(n) is number of such pairs of natural numbers t, u that A048720(t,u) = n and A065620(t)*u = n.

Crossrefs

Programs

  • PARI
    A048720(b,c) = fromdigits(Vec(Pol(binary(b))*Pol(binary(c)))%2, 2);
    A065621(n) = bitxor(n-1,n+n-1);
    A325565(n) = sumdiv(n,d,A048720(A065621(d),n/d)==n);
    
  • PARI
    A065620(n, c=1) = sum(i=0, logint(n+!n, 2), if(bittest(n, i), (-1)^c++<A065620
    A325565(n) = { my(p = Pol(binary(n))*Mod(1, 2)); sum(d=1,n,my(q = Pol(binary(d))*Mod(1, 2)); (0==(p%q) && (n==(A065620(d)*fromdigits(Vec(lift(p/q)),2))))); };

Formula

a(n) = Sum_{d|n} [A048720(A065621(d),n/d) == n], where [ ] is the Iverson bracket.
a(n) / a(A000265(n)) = A001511(n).
a(n) <= A000005(n) for all n.
a(n) <= A091220(n) for all n.

A348296 Irregular table T(n, k), n > 0, k = 1..A000120(n), read by rows; the n-th contains, in ascending order, the distinct powers of 2 summing to n.

Original entry on oeis.org

1, 2, 1, 2, 4, 1, 4, 2, 4, 1, 2, 4, 8, 1, 8, 2, 8, 1, 2, 8, 4, 8, 1, 4, 8, 2, 4, 8, 1, 2, 4, 8, 16, 1, 16, 2, 16, 1, 2, 16, 4, 16, 1, 4, 16, 2, 4, 16, 1, 2, 4, 16, 8, 16, 1, 8, 16, 2, 8, 16, 1, 2, 8, 16, 4, 8, 16, 1, 4, 8, 16, 2, 4, 8, 16, 1, 2, 4, 8, 16, 32
Offset: 1

Views

Author

Rémy Sigrist, Jul 18 2022

Keywords

Examples

			Triangle T(n, k) begins:
  n   n-th row
  --  ------------
   1  [1]
   2  [2]
   3  [1, 2]
   4  [4]
   5  [1, 4]
   6  [2, 4]
   7  [1, 2, 4]
   8  [8]
   9  [1, 8]
  10  [2, 8]
  11  [1, 2, 8]
  12  [4, 8]
  13  [1, 4, 8]
  14  [2, 4, 8]
  15  [1, 2, 4, 8]
		

Crossrefs

Programs

  • Mathematica
    Array[DeleteCases[Union@ NumberExpand[#, 2], 0] &, 32] // Flatten (* Michael De Vlieger, Jul 19 2022 *)
  • PARI
    row(n) = { my (r=vector(hammingweight(n))); for (k=1, #r, n -= r[k] = 2^valuation(n, 2)); return (r) }

Formula

T(n, k) = 2^A133457(n, k).
T(n, 1) = A006519(n).
T(n, A000120(n)) = A053644(n).
Sum_{k = 1..A000120(n)} T(n, k) = n.
Sum_{k = 1..A000120(n)} T(n, k) * (-1)^(k-1) = A065620(n).
Product_{k = 1..A000120(n)} T(n, k) = A059867(n).
T(2*n, k) = 2*T(n, k).

A246164 Permutation of natural numbers: a(1) = 1, a(A065621(n)) = A014580(a(n-1)), a(A048724(n)) = A091242(a(n)), where A065621(n) and A048724(n) are the reversing binary representation of n and -n, respectively, and A014580 resp. A091242 are the binary coded irreducible resp. reducible polynomials over GF(2).

Original entry on oeis.org

1, 2, 4, 11, 8, 5, 3, 7, 6, 9, 13, 17, 47, 31, 14, 61, 21, 42, 185, 24, 87, 319, 62, 12, 25, 19, 10, 59, 20, 15, 37, 229, 49, 22, 67, 76, 415, 103, 28, 18, 55, 137, 34, 41, 16, 27, 97, 78, 425, 109, 29, 1627, 222, 54, 283, 433, 79, 373, 3053, 33, 131, 647, 108, 847, 133, 745, 6943, 44, 193, 1053, 160, 504, 4333, 587, 99
Offset: 1

Views

Author

Antti Karttunen, Aug 19 2014

Keywords

Comments

This is an instance of entanglement permutation, where the two complementary pairs to be entangled with each other are A065621/A048724 and A014580/A091242 (binary codes for irreducible and reducible polynomials over GF(2)).
The former are themselves permutations of A000069/A001969 (odious and evil numbers), which means that this permutation shares many properties with A246162.
For the comments about the cycle structure, please see A246163.

Crossrefs

Formula

a(1) = 1, and for n > 1, if A010060(n) = 1 [i.e. when n is an odious number], a(n) = A014580(a(A065620(n)-1)), otherwise a(n) = A091242(a(- (A065620(n)))). [A065620 Converts sum of powers of 2 in binary representation of n to an alternating sum].
As a composition of related permutations:
a(n) = A246202(A193231(n)).
a(n) = A245702(A234025(n)).
a(n) = A246162(A234612(n)).
a(n) = A193231(A246204(A193231(n))).
For all n > 1, A091225(a(n)) = A010060(n). [Maps odious numbers to binary representations of irreducible GF(2) polynomials (A014580) and evil numbers to the corresponding representations of reducible polynomials (A091242), in some order. A246162 has the same property].

A246159 Inverse function to the injection A048724.

Original entry on oeis.org

0, 0, 0, 1, 0, 3, 2, 0, 0, 7, 6, 0, 4, 0, 0, 5, 0, 15, 14, 0, 12, 0, 0, 13, 8, 0, 0, 9, 0, 11, 10, 0, 0, 31, 30, 0, 28, 0, 0, 29, 24, 0, 0, 25, 0, 27, 26, 0, 16, 0, 0, 17, 0, 19, 18, 0, 0, 23, 22, 0, 20, 0, 0, 21, 0, 63, 62, 0, 60, 0, 0, 61, 56, 0, 0, 57, 0, 59, 58, 0, 48, 0, 0, 49, 0, 51, 50, 0, 0, 55, 54, 0, 52, 0, 0, 53, 32
Offset: 0

Views

Author

Antti Karttunen, Aug 18 2014

Keywords

Comments

After a(0)=0, sequence has nonzero values a(n) = k at those positions n for which A048724(k) = n and zeros at those positions n which are not present in A048724.
Equally, sequence is obtained when the positive terms of A065620 are replaced with zeros and the sign of the negative terms is reversed.

Crossrefs

Programs

  • PARI
    a065620(n) = if(n<3, n, if(n%2, -2*a065620((n - 1)/2) + 1, 2*a065620(n/2)));
    a(n) = -!(hammingweight(n)%2)*a065620(n);
    for(n=0, 100, print1(a(n),", ")) \\ Indranil Ghosh, Jun 07 2017
    
  • Python
    def a065620(n): return n if n<3 else 2*a065620(n//2) if n%2==0 else -2*a065620((n - 1)//2) + 1
    def a(n): return -(bin(n)[2:].count("1")%2==0)*a065620(n)
    print([a(n) for n in range(101)]) # Indranil Ghosh, Jun 07 2017

Formula

a(n) = (1/2) * A010059(n) * A006068(n).
a(n) = -1 * A010059(n) * A065620(n).
a(n) = A246160(n) - A065620(n).
a(n) = A010059(n) * A006068(A245710(n)).
For all n, a(A048724(n)) = n.

A246160 Inverse function to the injection A065621.

Original entry on oeis.org

0, 1, 2, 0, 4, 0, 0, 3, 8, 0, 0, 7, 0, 5, 6, 0, 16, 0, 0, 15, 0, 13, 14, 0, 0, 9, 10, 0, 12, 0, 0, 11, 32, 0, 0, 31, 0, 29, 30, 0, 0, 25, 26, 0, 28, 0, 0, 27, 0, 17, 18, 0, 20, 0, 0, 19, 24, 0, 0, 23, 0, 21, 22, 0, 64, 0, 0, 63, 0, 61, 62, 0, 0, 57, 58, 0, 60, 0, 0, 59, 0, 49, 50, 0, 52
Offset: 0

Views

Author

Antti Karttunen, Aug 18 2014

Keywords

Comments

Sequence has nonzero values a(n) = k at those points n for which A065621(k) = n and zeros at those positions n which are not present in A065621.
Equally, sequence is obtained when the negative terms of A065620 are replaced with zeros

Crossrefs

Programs

  • PARI
    a065620(n) = if(n<3, n, if(n%2, -2*a065620((n - 1)/2) + 1, 2*a065620(n/2)));
    a(n) = (hammingweight(n)%2)*a065620(n);
    for(n=0, 100, print1(a(n),", ")) \\ Indranil Ghosh, Jun 07 2017
    
  • Python
    def a065620(n): return n if n<3 else 2*a065620(n//2) if n%2==0 else -2*a065620((n - 1)//2) + 1
    def a(n): return (bin(n)[2:].count("1")%2)*a065620(n)
    print([a(n) for n in range(101)]) # Indranil Ghosh, Jun 07 2017

Formula

a(n) = A010060(n) * A065620(n).
a(n) = A246159(n) + A065620(n).
a(0) = 0, and for n >= 1, a(n) = A010060(n) * (1 + A006068(A115384(n)-1)).
For all n, a(A065621(n)) = n.

A273672 Permutation of natural numbers induced by looking up the position of fraction A270418(n)/A270419(n) from the full Stern-Brocot tree A007305(n+1)/A047679(n-1).

Original entry on oeis.org

1, 3, 7, 15, 31, 63, 127, 2, 511, 1023, 2047, 4095, 8191, 16383, 32767, 65535, 131071, 262143, 524287, 1048575, 2097151, 4194303, 8388607, 6, 33554431, 67108863, 4, 268435455, 536870911, 1073741823, 2147483647, 128, 8589934591, 17179869183, 34359738367, 68719476735, 137438953471, 274877906943, 549755813887, 14
Offset: 1

Views

Author

Antti Karttunen, May 27 2016

Keywords

Crossrefs

Inverse: A273671.
Cf. also A007305, A047679.

Programs

  • PARI
    A065620(n, c=1) = sum(i=0, logint(n+!n, 2), if(bittest(n, i), (-1)^c++<A065620
    SBtree_index(r) = { my(m=numerator(r),n=denominator(r),z=1); while(m!=n, if(mA273672(n) = { n=factor(n); n[, 2] = apply(A065620, n[, 2]); SBtree_index(factorback(n)); }; \\ Antti Karttunen, Mar 07 2020, based also on M. F. Hasler's code in A270418 and A270419
  • Scheme
    (define (A273672 n) (SBtree_index (A270418 n) (A270419 n)))
    (define (SBtree_index m n) (let loop ((m m) (n n) (z 1)) (cond ((= m n) z) ((< m n) (loop m (- n m) (+ z z))) (else (loop (- m n) n (+ z z 1))))))
    

A295881 Reversing binary representation of the deficiency of n, A033879(n).

Original entry on oeis.org

1, 1, 2, 1, 4, 0, 14, 1, 13, 2, 26, 12, 28, 4, 14, 1, 16, 5, 50, 6, 26, 8, 62, 20, 55, 26, 22, 0, 44, 20, 38, 1, 50, 22, 62, 53, 100, 16, 62, 30, 104, 20, 122, 4, 28, 52, 118, 36, 121, 11, 38, 14, 84, 20, 110, 24, 98, 42, 74, 80, 76, 44, 62, 1, 118, 20, 194, 26, 122, 12, 206, 85, 200, 98, 42, 28, 74, 20, 214, 46, 121
Offset: 1

Views

Author

Antti Karttunen, Dec 04 2017

Keywords

Comments

For all n, A010060(a(A005100(n))) = 1 and A010060(a(A023196(n))) = 0. That is, for the deficient numbers a(n) is an odious number (A000069) and for the nondeficient numbers a(n) is an evil number (A001969).

Crossrefs

Cf. A000396 (gives the positions of zeros).

Programs

Formula

If A033879(n) <= 0, a(n) = A048724(-A033879(n)), otherwise a(n) = A065621(A033879(n)).
For all n >= 1, A065620(a(n)) = A033879(n).

A104895 a(0)=0; thereafter a(2n) = -2*a(n), a(2n+1) = 2*a(n) - 1.

Original entry on oeis.org

0, -1, -2, 1, -4, 3, 2, -3, -8, 7, 6, -7, 4, -5, -6, 5, -16, 15, 14, -15, 12, -13, -14, 13, 8, -9, -10, 9, -12, 11, 10, -11, -32, 31, 30, -31, 28, -29, -30, 29, 24, -25, -26, 25, -28, 27, 26, -27, 16, -17, -18, 17, -20, 19, 18, -19, -24, 23, 22, -23, 20, -21, -22, 21, -64, 63, 62, -63, 60, -61, -62, 61, 56, -57, -58, 57, -60, 59
Offset: 0

Views

Author

Philippe Deléham, Apr 24 2005

Keywords

Comments

Columns of table in A104894 written in base 10.
Conjecture: the positions where 0, 1, 2, 3, ... appear are given by A048724; the positions where -1, -2, -3, ... appear are given by A065621.

Crossrefs

The negative of entry A065620.

Programs

  • Haskell
    import Data.List (transpose)
    a104895 n = a104895_list !! n
    a104895_list = 0 : concat (transpose [map (negate . (+ 1)) zs, tail zs])
                   where zs = map (* 2) a104895_list
    -- Reinhard Zumkeller, Mar 26 2014
    
  • Maple
    f:=proc(n) option remember; if n=0 then RETURN(0); fi; if n mod 2 = 0 then RETURN(2*f(n/2)); else RETURN(-2*f((n-1)/2)-1); fi; end;
  • Mathematica
    a[0] = 0;
    a[n_]:= a[n]= If[EvenQ[n], 2 a[n/2], -2 a[(n-1)/2] - 1];
    Table[a[n], {n, 0, 100}] (* Jean-François Alcover, Aug 03 2018 *)
  • Sage
    def a(n):
        if (n==0): return 0
        elif (mod(n,2)==0): return 2*a(n/2)
        else: return -2*a((n-1)/2) - 1
    [a(n) for n in (0..100)] # G. C. Greubel, Jun 15 2021

Formula

a(0) = 0 and for k>=0, 0<= j <2^k, a(2^k + j) = a(j) + 2^k if a(j)<0, a(2^k + j) = a(j) - 2^k if a(j)>=0.
Sum_{0 <= n <= 2^k - 1} a(n) = - 2^(k-1).
Sum_{0 <= n <= 2^k - 1} |a(n)| = 4^(k-1).
a(n) = -A065620(n). - M. F. Hasler, Apr 16 2018

Extensions

Corrected by N. J. A. Sloane, Nov 05 2005
Edited by N. J. A. Sloane, Apr 25 2018

A323908 Reversing binary representation of A004718, Per Nørgård's "infinity sequence".

Original entry on oeis.org

0, 1, 3, 2, 1, 0, 6, 7, 3, 2, 0, 1, 2, 3, 5, 4, 1, 0, 6, 7, 0, 1, 3, 2, 6, 7, 1, 0, 7, 6, 12, 13, 3, 2, 0, 1, 2, 3, 5, 4, 0, 1, 3, 2, 1, 0, 6, 7, 2, 3, 5, 4, 3, 2, 0, 1, 5, 4, 2, 3, 4, 5, 15, 14, 1, 0, 6, 7, 0, 1, 3, 2, 6, 7, 1, 0, 7, 6, 12, 13, 0, 1, 3, 2, 1, 0, 6, 7, 3, 2, 0, 1, 2, 3, 5, 4, 6, 7, 1, 0, 7, 6, 12, 13, 1, 0
Offset: 0

Views

Author

Antti Karttunen, Feb 09 2019

Keywords

Comments

The composer Per Nørgård's name is also written in the OEIS as Per Noergaard.

Crossrefs

Cf. A004718, A048724, A065620, A065621, A083866 (positions of zeros), A323907 (rgs-transform), A323909.

Programs

  • PARI
    up_to = 65536;
    A004718list(up_to) = { my(v=vector(up_to)); v[1]=1; v[2]=-1; for(n=3, up_to, v[n] = if(n%2, 1+v[n>>1], -v[n/2])); (v); }; \\ After code in A004718.
    v004718 = A004718list(up_to);
    A004718(n) = if(!n,n,v004718[n]);
    A048724(n) = bitxor(n, n<<1);
    A065621(n) = bitxor(n-1,n+n-1);
    A323908(n) = if(A004718(n)<=0, A048724(-A004718(n)), A065621(A004718(n)));
    
  • Python
    from itertools import groupby
    def A323908(n):
        c = 0
        for k, g in groupby(bin(n)[2:]):
            c = c+len(list(g)) if k == '1' else (-c if len(list(g))&1 else c)
        return -c^(-c<<1) if c<=0 else c^(c&~-c)<<1 # Chai Wah Wu, Mar 02 2023

Formula

If A004718(n) <= 0, a(n) = A048724(-A004718(n)), otherwise a(n) = A065621(A004718(n)).
For all n >= 1, A065620(a(n)) = A004718(n).

A297153 Reversing binary representation of A083254(n), 2*phi(n) - n.

Original entry on oeis.org

1, 0, 1, 0, 7, 6, 13, 0, 7, 6, 25, 12, 31, 6, 1, 0, 19, 10, 49, 12, 7, 6, 61, 24, 19, 6, 25, 12, 47, 18, 37, 0, 11, 6, 21, 20, 103, 6, 25, 24, 107, 54, 121, 12, 7, 6, 117, 48, 103, 30, 21, 12, 87, 54, 41, 24, 19, 6, 73, 36, 79, 6, 25, 0, 35, 46, 193, 12, 55, 58, 205, 40, 203, 6, 13, 12, 127, 34, 213, 48, 47, 6, 241
Offset: 1

Views

Author

Antti Karttunen, Dec 26 2017

Keywords

Crossrefs

Programs

Formula

If A083254(n) > 0, then a(n) = A065621(A083254(n)), otherwise a(n) = A048724(-A083254(n)).
For all n >= 1, A065620(a(n)) = A083254(n)
Previous Showing 11-20 of 28 results. Next