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

A270419 Denominator of the rational number obtained when the exponents in prime factorization of n are reinterpreted as alternating binary sums (A065620).

Original entry on oeis.org

1, 1, 1, 1, 1, 1, 1, 2, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 2, 1, 1, 3, 1, 1, 1, 1, 8, 1, 1, 1, 1, 1, 1, 1, 2, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 3, 1, 2, 1, 1, 1, 1, 1, 1, 1, 4, 1, 1, 1, 1, 1, 1, 1, 2, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 2, 1, 1, 1, 1, 1, 1, 1, 8, 1, 1, 1, 1, 1, 1, 1, 2, 1, 1, 1, 3, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 2
Offset: 1

Views

Author

Antti Karttunen, May 23 2016

Keywords

Comments

Map n -> A270418(n)/A270419(n) is a bijection from N (1, 2, 3, ...) to the set of positive rationals.

Crossrefs

Cf. A270418 (gives the numerators).
Cf. A270428 (indices of ones).
Cf. also A270420, A270421, A270436, A270437 and permutation pair A273671/A273672.
Differs from A055229 for the first time at n=32, where a(32)=8, while A055229(32)=2.

Programs

  • Mathematica
    s[n_] := s[n] = If[OddQ[n], -2*s[(n - 1)/2] - 1, 2*s[n/2]]; s[0] = 0; f[p_, e_] := p^If[OddQ[DigitCount[e, 2, 1]], 0, s[e]]; a[1] = 1; a[n_] := Times @@ f @@@ FactorInteger[n]; Array[a, 100] (* Amiram Eldar, Sep 01 2023 *)
  • PARI
    A270419(n)={n=factor(n);n[,2]=apply(A065620,n[,2]);denominator(factorback(n))} \\ M. F. Hasler, Apr 16 2018

Formula

Multiplicative with a(p^e) = p^(-A065620(e)) for evil e, a(p^e)=1 for odious e, or equally, a(p^e) = p^(A010059(e) * -A065620(e)).
a(1) = 1, for n > 1, a(n) = a(A028234(n)) * A020639(n)^( A010059(A067029(n)) * -A065620(A067029(n)) ).
Other identities. For all n >= 1:
a(A270436(n)) = 1, a(A270437(n)) = n.

A270418 Numerator of the rational number obtained when exponents in prime factorization of n are reinterpreted as alternating binary sums (A065620).

Original entry on oeis.org

1, 2, 3, 4, 5, 6, 7, 1, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 3, 25, 26, 1, 28, 29, 30, 31, 1, 33, 34, 35, 36, 37, 38, 39, 5, 41, 42, 43, 44, 45, 46, 47, 48, 49, 50, 51, 52, 53, 2, 55, 7, 57, 58, 59, 60, 61, 62, 63, 1, 65, 66, 67, 68, 69, 70, 71, 9, 73, 74, 75, 76, 77, 78, 79, 80, 81
Offset: 1

Views

Author

Antti Karttunen, May 23 2016

Keywords

Comments

Map n -> A270418(n)/A270419(n) is a bijection from N (1, 2, 3, ...) to the set of positive rationals.

Crossrefs

Cf. A270419 (gives the denominators).
Cf. A262675 (indices of ones).
Cf. also A270420, A270421, A270436, A270437 and permutation pair A273671/A273672.
Differs from A056192 for the first time at n=32, which here a(32)=1, while A056192(32)=4.

Programs

  • Mathematica
    s[0] = 0; s[n_]:= s[n]= If[OddQ[n], 1 - 2*s[(n-1)/2], 2*s[n/2]]; f[p_, e_] := p^(ThueMorse[e] * s[e]); a[n_] := Times @@ f @@@ FactorInteger[n]; a[1] = 1; Array[a, 100] (* Amiram Eldar, Sep 05 2023 *)
  • PARI
    A270418(n)={n=factor(n);n[,2]=apply(A065620,n[,2]);numerator(factorback(n))} \\ M. F. Hasler, Apr 16 2018

Formula

Multiplicative with a(p^e) = p^A065620(e) for odious e, a(p^e)=1 for evil e, or equally, a(p^e) = p^(A010060(e)*A065620(e)).
a(1) = 1, for n > 1, a(n) = a(A028234(n)) * A020639(n)^( A010060(A067029(n)) * A065620(A067029(n)) ).
Other identities. For all n >= 1:
a(A270436(n)) = n, a(A270437(n)) = 1.

A245812 Self-inverse permutation of natural numbers: a(0) = 0, a(1) = 1, and for n > 1, if A065620(n) < 0, a(n) = A065621(1+a(-(A065620(n)))), otherwise a(n) = A048724(a(A065620(n)-1)).

Original entry on oeis.org

0, 1, 3, 2, 6, 7, 4, 5, 15, 14, 13, 12, 11, 10, 9, 8, 24, 25, 26, 27, 28, 29, 30, 31, 16, 17, 18, 19, 20, 21, 22, 23, 57, 56, 59, 58, 61, 60, 63, 62, 49, 48, 51, 50, 53, 52, 55, 54, 41, 40, 43, 42, 45, 44, 47, 46, 33, 32, 35, 34, 37, 36, 39, 38, 106, 107, 104, 105, 110, 111, 108, 109, 98, 99, 96, 97, 102, 103, 100
Offset: 0

Views

Author

Antti Karttunen, Aug 20 2014

Keywords

Comments

This is an instance of entanglement permutation, where complementary pair A048724/A065621 is entangled with the same pair in the opposite order: A065621/A048724, with a(1) set to 1.
Note how this is A193231-conjugate of A054429.

Crossrefs

Programs

  • PARI
    a048724(n) = bitxor(n, 2*n);
    a065620(n) = if(n<3, n, if(n%2, -2*a065620((n - 1)/2) + 1, 2*a065620(n/2)));
    a065621(n) = bitxor(n, 2*(n - bitand(n, -n)));
    a(n) = x=a065620(n); if(n<2, n, if(x<0, a065621(1 + a(-x)), a048724(a(x - 1))));
    for(n=0, 100, print1(a(n),", ")) \\ Indranil Ghosh, Jun 07 2017
    
  • Python
    def a048724(n): return n^(2*n)
    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 a065621(n): return n^(2*(n - (n & -n)))
    def a(n):
        x=a065620(n)
        return n if n<2 else a065621(1 + a(-x)) if x<0 else a048724(a(x - 1))
    print([a(n) for n in range(101)]) # Indranil Ghosh, Jun 07 2017

Formula

a(0) = 0, a(1) = 1, and for n > 1, if A065620(n) < 0, a(n) = A065621(1+a(-(A065620(n)))), otherwise a(n) = A048724(a(A065620(n)-1)).
Equally:
a(0) = 0, a(1) = 1, and for n > 1, if A010060(n) = 0, a(n) = A065621(1+a(A246159(n))), otherwise a(n) = A048724(a(A246160(n)-1)). [Note how A246159 is an inverse function for A048724, while A246160 is an inverse function for A065621].
As a composition of related permutations:
a(n) = A193231(A234025(n)).
a(n) = A234026(A193231(n)).
a(n) = A193231(A054429(A193231(n))).

A355819 Dirichlet inverse of A270419, denominator of the rational number obtained when the exponents in prime factorization of n are reinterpreted as alternating binary sums (A065620).

Original entry on oeis.org

1, -1, -1, 0, -1, 1, -1, -1, 0, 1, -1, 0, -1, 1, 1, 2, -1, 0, -1, 0, 1, 1, -1, 1, 0, 1, -2, 0, -1, -1, -1, -8, 1, 1, 1, 0, -1, 1, 1, 1, -1, -1, -1, 0, 0, 1, -1, -2, 0, 0, 1, 0, -1, 2, 1, 1, 1, 1, -1, 0, -1, 1, 0, 12, 1, -1, -1, 0, 1, -1, -1, 0, -1, 1, 0, 0, 1, -1, -1, -2, 4, 1, -1, 0, 1, 1, 1, 1, -1, 0, 1, 0, 1, 1, 1, 8
Offset: 1

Views

Author

Antti Karttunen, Jul 19 2022

Keywords

Comments

Multiplicative because A270419 is.

Crossrefs

Cf. also A355826.

Programs

  • PARI
    A065620(n, c=1) = sum(i=0, logint(n+!n, 2), if(bittest(n, i), (-1)^c++<A065620
    A270419(n) = {n=factor(n); n[, 2]=apply(A065620, n[, 2]); denominator(factorback(n)); }; \\ From A270419
    memoA355819 = Map();
    A355819(n) = if(1==n,1,my(v); if(mapisdefined(memoA355819,n,&v), v, v = -sumdiv(n,d,if(dA270419(n/d)*A355819(d),0)); mapput(memoA355819,n,v); (v)));

Formula

a(1) = 1, and for n > 1, a(n) = -Sum_{d|n, dA270419(n/d) * a(d).

A365713 Dirichlet inverse of reversing binary value of n (A065620).

Original entry on oeis.org

1, -2, 1, 0, 3, -2, -3, 0, 8, -6, -7, 0, -5, 6, 11, 0, 15, -16, -15, 0, -19, 14, 13, 0, 0, 10, 24, 0, 11, -22, -11, 0, 17, -30, -49, 0, -29, 30, 19, 0, -25, 38, 25, 0, 88, -26, -27, 0, -8, 0, 47, 0, 19, -48, -61, 0, -7, -22, -23, 0, -21, 22, -56, 0, 33, -34, -63, 0, -35, 98, 61, 0, -57, 58, 96, 0, 101, -38, -59, 0
Offset: 1

Views

Author

Antti Karttunen, Sep 19 2023

Keywords

Crossrefs

Cf. also A355819, A365711.

Programs

  • PARI
    A065620(n, c=1) = sum(i=0, logint(n+!n, 2), if(bittest(n, i), (-1)^c++<A065620 by M. F. Hasler
    memoA365713 = Map();
    A365713(n) = if(1==n,1,my(v); if(mapisdefined(memoA365713,n,&v), v, v = -sumdiv(n,d,if(dA065620(n/d)*A365713(d),0)); mapput(memoA365713,n,v); (v)));

Formula

a(1) = 1, and for n > 1, a(n) = -Sum_{d|n, dA065620(n/d) * a(d).

A365714 Sum of reversing binary value of n (A065620) and its Dirichlet inverse.

Original entry on oeis.org

2, 0, 0, 4, 0, -4, 0, 8, 1, -12, 0, -4, 0, 12, 6, 16, 0, -30, 0, -12, -6, 28, 0, -8, 9, 20, 15, 12, 0, -32, 0, 32, -14, -60, -18, -28, 0, 60, -10, -24, 0, 64, 0, 28, 61, -52, 0, -16, 9, 18, 30, 20, 0, -66, -42, 24, -30, -44, 0, -20, 0, 44, -77, 64, -30, -96, 0, -60, 26, 160, 0, -56, 0, 116, 39, 60, 42, -96, 0, -48, 89
Offset: 1

Views

Author

Antti Karttunen, Sep 19 2023

Keywords

Crossrefs

Cf. also A365712.

Programs

Formula

a(n) = A065620(n) + A365713(n).
a(1) = 2, and for n > 1, a(n) = -Sum_{d|n, 1A065620(d) * A365713(n/d).
a(4*n)/4 = A065620(n).

A033879 Deficiency of n, or 2n - (sum of divisors of n).

Original entry on oeis.org

1, 1, 2, 1, 4, 0, 6, 1, 5, 2, 10, -4, 12, 4, 6, 1, 16, -3, 18, -2, 10, 8, 22, -12, 19, 10, 14, 0, 28, -12, 30, 1, 18, 14, 22, -19, 36, 16, 22, -10, 40, -12, 42, 4, 12, 20, 46, -28, 41, 7, 30, 6, 52, -12, 38, -8, 34, 26, 58, -48, 60, 28, 22, 1, 46, -12, 66, 10, 42, -4, 70, -51
Offset: 1

Views

Author

Keywords

Comments

Records for the sequence of the absolute values are in A075728 and the indices of these records in A074918. - R. J. Mathar, Mar 02 2007
a(n) = 1 iff n is a power of 2. a(n) = n - 1 iff n is prime. - Omar E. Pol, Jan 30 2014
If a(n) = 1 then n is called a least deficient number or an almost perfect number. All the powers of 2 are least deficient numbers but it is not known if there exists a least deficient number that is not a power of 2. See A000079. - Jianing Song, Oct 13 2019
It is not known whether there are any -1's in this sequence. See comment in A033880. - Antti Karttunen, Feb 02 2020

Examples

			For n = 10 the divisors of 10 are 1, 2, 5, 10, so the deficiency of 10 is 10 minus the sum of its proper divisors or simply 10 - 5 - 2 - 1 = 2. - _Omar E. Pol_, Dec 27 2013
		

References

  • Richard K. Guy, Unsolved Problems in Number Theory, 3rd Edition, Springer, 2004, Section B2, pp. 74-84.
  • James J. Tattersall, Elementary Number Theory in Nine Chapters, Cambridge University Press, 1999, page 147.

Crossrefs

Cf. A000396 (positions of zeros), A005100 (of positive terms), A005101 (of negative terms).
Cf. A141545 (positions of a(n) = -12).
For this sequence applied to various permutations of natural numbers and some other sequences, see A323174, A323244, A324055, A324185, A324546, A324574, A324575, A324654, A325379.

Programs

Formula

a(n) = -A033880(n).
a(n) = A005843(n) - A000203(n). - Omar E. Pol, Dec 14 2008
a(n) = n - A001065(n). - Omar E. Pol, Dec 27 2013
G.f.: 2*x/(1 - x)^2 - Sum_{k>=1} k*x^k/(1 - x^k). - Ilya Gutkovskiy, Jan 24 2017
a(n) = A286385(n) - A252748(n). - Antti Karttunen, May 13 2017
From Antti Karttunen, Dec 29 2017: (Start)
a(n) = Sum_{d|n} A083254(d).
a(n) = Sum_{d|n} A008683(n/d)*A296075(d).
a(n) = A065620(A295881(n)) = A117966(A295882(n)).
a(n) = A294898(n) + A000120(n).
(End)
From Antti Karttunen, Jun 03 2019: (Start)
Sequence can be represented in arbitrarily many ways as a difference of the form (n - f(n)) - (g(n) - n), where f and g are any two sequences whose sum f(n)+g(n) = sigma(n). Here are few examples:
a(n) = A325314(n) - A325313(n) = A325814(n) - A034460(n) = A325978(n) - A325977(n).
a(n) = A325976(n) - A325826(n) = A325959(n) - A325969(n) = A003958(n) - A324044(n).
a(n) = A326049(n) - A326050(n) = A326055(n) - A326054(n) = A326044(n) - A326045(n).
a(n) = A326058(n) - A326059(n) = A326068(n) - A326067(n).
a(n) = A326128(n) - A326127(n) = A066503(n) - A326143(n).
a(n) = A318878(n) - A318879(n).
a(A228058(n)) = A325379(n). (End)
Sum_{k=1..n} a(k) ~ c * n^2, where c = 1 - Pi^2/12 = 0.177532... . - Amiram Eldar, Dec 07 2023

Extensions

Definition corrected by N. J. A. Sloane, Jul 04 2005

A065621 Reversing binary representation of n. Converting sum of powers of 2 in binary representation of a(n) to alternating sum gives n.

Original entry on oeis.org

1, 2, 7, 4, 13, 14, 11, 8, 25, 26, 31, 28, 21, 22, 19, 16, 49, 50, 55, 52, 61, 62, 59, 56, 41, 42, 47, 44, 37, 38, 35, 32, 97, 98, 103, 100, 109, 110, 107, 104, 121, 122, 127, 124, 117, 118, 115, 112, 81, 82, 87, 84, 93, 94, 91, 88, 73, 74, 79, 76, 69, 70, 67, 64, 193
Offset: 1

Views

Author

Marc LeBrun, Nov 07 2001

Keywords

Comments

a(0)=0. The alternation is applied only to the nonzero bits and does not depend on the exponent of two. All integers have a unique reversing binary representation (see cited exercise for proof). Complement of A048724.
A permutation of the "odious" numbers A000069.
Write n-1 and 2n-1 in binary and add them mod 2; example: n = 6, n-1 = 5 = 101 in binary, 2n-1 = 11 = 1011 in binary and their sum is 1110 = 14, so a(6) = 14. - Philippe Deléham, Apr 29 2005
As already pointed out, this is a permutation of the odious numbers A000069 and A010060(A000069(n)) = 1, so A010060(a(n)) = 1; and A010060(A048724(n)) = 0. - Philippe Deléham, Apr 29 2005. Also a(n) = A000069(A003188(n - 1)).

Examples

			a(5) = 13 = 8 + 4 + 1 -> 8 - 4 + 1 = 5.
		

References

  • D. E. Knuth, The Art of Computer Programming. Addison-Wesley, Reading, MA, 1969, Vol. 2, p. 178, (exercise 4.1. Nr. 27)

Crossrefs

Differs from A115857 for the first time at n=19, where a(19)=55, while A115857(19)=23. Cf. A104895, A115872, A114389, A114390, A105081.
Cf. A245471.

Programs

  • Haskell
    import Data.Bits (xor, (.&.))
    a065621 n = n `xor` 2 * (n - n .&. negate n) :: Integer
    -- Reinhard Zumkeller, Mar 26 2014
    
  • Mathematica
    f[n_] := BitXor[n, 2 n + 1]; Array[f, 60, 0] (* Robert G. Wilson v, Jun 09 2010 *)
  • PARI
    a(n)=if(n<2,1,if(n%2==0,2*a(n/2),2*a((n+1)/2)-2*(-1)^((n-1)/2)+1))
    
  • Python
    def a(n): return n^(2*(n - (n & -n))) # Indranil Ghosh, Jun 04 2017
    
  • Python
    def A065621(n): return n^ (n&~-n)<<1 # Chai Wah Wu, Jun 29 2022

Formula

a(n) = if n=0 or n=1 then n else b+2*a(b+(1-2*b)*n)/2) where b is the least significant bit in n.
a(n) = n XOR 2 (n - (n AND -n)).
a(1) = 1, a(2n) = 2*a(n), a(2n+1) = 2*a(n+1) - 2(-1)^n + 1. - Ralf Stephan, Aug 20 2003
a(n) = A048724(n-1) - (-1)^n. - Ralf Stephan, Sep 10 2003
a(n) = Sum_{k=0..n} (1-(-1)^round(-n/2^k))/2*2^k. - Benoit Cloitre, Apr 27 2005
Closely related to Gray codes in another way: a(n) = 2 * A003188(n-1) + (n mod 2); a(n) = 4 * A003188((n-1) div 2) + (n mod 4). - Matt Erbst (matt(AT)erbst.org), Jul 18 2006 [corrected by Peter Munn, Jan 30 2021]
a(n) = n XOR 2(n AND NOT -n). - Chai Wah Wu, Jun 29 2022
a(n) = A003188(2n-1). - Friedjof Tellkamp, Jan 18 2024

Extensions

More terms from Ralf Stephan, Sep 08 2003

A048724 Write n and 2n in binary and add them mod 2.

Original entry on oeis.org

0, 3, 6, 5, 12, 15, 10, 9, 24, 27, 30, 29, 20, 23, 18, 17, 48, 51, 54, 53, 60, 63, 58, 57, 40, 43, 46, 45, 36, 39, 34, 33, 96, 99, 102, 101, 108, 111, 106, 105, 120, 123, 126, 125, 116, 119, 114, 113, 80, 83, 86, 85, 92, 95, 90, 89, 72, 75, 78, 77, 68, 71, 66, 65, 192
Offset: 0

Views

Author

Antti Karttunen, Apr 26 1999

Keywords

Comments

Reversing binary representation of -n. Converting sum of powers of 2 in binary representation of a(n) to alternating sum gives -n. Note that the alternation is applied only to the nonzero bits and does not depend on the exponent of two. All integers have a unique reversing binary representation (see cited exercise for proof). Complement of A065621. - Marc LeBrun, Nov 07 2001
A permutation of the "evil" numbers A001969. - Marc LeBrun, Nov 07 2001
A048725(n) = a(a(n)). - Reinhard Zumkeller, Nov 12 2004

Examples

			12 = 1100 in binary, 24=11000 and their sum is 10100=20, so a(12)=20.
a(4) = 12 = + 8 + 4 -> - 8 + 4 = -4.
		

References

  • D. E. Knuth, The Art of Computer Programming. Addison-Wesley, Reading, MA, 1969, Vol. 2, p. 178, (exercise 4.1. Nr. 27)

Crossrefs

Bisection of A003188 (even part).
See also A065620, A065621.
Cf. A242399.

Programs

Formula

a(n) = Xmult(n, 3) (or n XOR (n<<1)).
a(n) = A065621(-n).
a(2n) = 2a(n), a(2n+1) = 2a(n) + 2(-1)^n + 1.
G.f. 1/(1-x) * sum(k>=0, 2^k*(3t-t^3)/(1+t)/(1+t^2), t=x^2^k). - Ralf Stephan, Sep 08 2003
a(n) = sum(k=0, n, (1-(-1)^round(+n/2^k))/2*2^k). - Benoit Cloitre, Apr 27 2005
a(n) = A001969(A003188(n)). - Philippe Deléham, Apr 29 2005
a(n) = A106409(2*n) for n>0. - Reinhard Zumkeller, May 02 2005
a(n) = A142149(2*n). - Reinhard Zumkeller, Jul 15 2008

A083254 a(n) = 2*phi(n) - n.

Original entry on oeis.org

1, 0, 1, 0, 3, -2, 5, 0, 3, -2, 9, -4, 11, -2, 1, 0, 15, -6, 17, -4, 3, -2, 21, -8, 15, -2, 9, -4, 27, -14, 29, 0, 7, -2, 13, -12, 35, -2, 9, -8, 39, -18, 41, -4, 3, -2, 45, -16, 35, -10, 13, -4, 51, -18, 25, -8, 15, -2, 57, -28, 59, -2, 9, 0, 31, -26, 65, -4, 19, -22, 69, -24, 71, -2, 5, -4, 43, -30, 77, -16, 27, -2, 81, -36, 43, -2, 25
Offset: 1

Views

Author

Labos Elemer, May 08 2003

Keywords

Comments

Möbius transform of A033879, deficiency of n. - Antti Karttunen, Dec 26 2017

Examples

			Case 1# - totient(x)-cototient[x] = 0 if x is a power of 2;
Case 2# - totient(x)>cototient[x] gives odd primes and also A067800, (= A014076 except probably A036798); e.g. n = 33: a(33) = 2.20-33 = 7; n = p prime: a(p) = p-2;
Case 3# - totient(x)<cototient[x] gives even numbers without powers of 2 and most probably A036798; e.g. n = 20: a(20) = -4; n = 105: a(105) = 2.48-105 = 96-105 = -9.
		

Crossrefs

Programs

Formula

a(n) = totient(n) - cototient(n) = A000010(n) - A051953(n).
From Antti Karttunen, Dec 26 2017: (Start)
a(n) = A065620(A297153(n)) = A117966(A297154(n)).
a(n) = A297114(n) + A297115(n).
a(2n) = A297114(2n).
For all n >= 1, -a(A000010(n)) = A293516(n).
(End)
Sum_{k=1..n} a(k) ~ c * n^2, where c = 6/Pi^2 - 1/2 = 0.107927... . - Amiram Eldar, Sep 07 2023
Showing 1-10 of 28 results. Next