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

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

A022340 Even Fibbinary numbers (A003714); also 2*Fibbinary(n).

Original entry on oeis.org

0, 2, 4, 8, 10, 16, 18, 20, 32, 34, 36, 40, 42, 64, 66, 68, 72, 74, 80, 82, 84, 128, 130, 132, 136, 138, 144, 146, 148, 160, 162, 164, 168, 170, 256, 258, 260, 264, 266, 272, 274, 276, 288, 290, 292, 296, 298, 320, 322, 324, 328, 330, 336, 338, 340, 512
Offset: 0

Views

Author

Keywords

Comments

Positions of ones in binomial(3k+2,k+1)/(3k+2) modulo 2 (A085405). - Paul D. Hanna, Jun 29 2003
Construction: start with strings S(0)={0}, S(1)={2}; for k>=2, concatenate all prior strings excluding S(k-1) and add 2^k to each element in the resulting string to obtain S(k); this sequence is the concatenation of all such generated strings: {S(0),S(1),S(2),...}. Example: for k=5, concatenate {S(0),S(1),S(2),S(3)} = {0, 2, 4, 8,10}; add 2^5 to each element to obtain S(5)={32,34,38,40,42}. - Paul D. Hanna, Jun 29 2003
From Gus Wiseman, Apr 08 2020: (Start)
The k-th composition in standard order (row k of A066099) is obtained by taking the set of positions of 1's in the reversed binary expansion of k, prepending 0, taking first differences, and reversing again. This gives a bijective correspondence between nonnegative integers and integer compositions. This sequence lists all numbers k such that the k-th composition in standard order has no ones. For example, the sequence together with the corresponding compositions begins:
0: () 80: (2,5) 260: (6,3)
2: (2) 82: (2,3,2) 264: (5,4)
4: (3) 84: (2,2,3) 266: (5,2,2)
8: (4) 128: (8) 272: (4,5)
10: (2,2) 130: (6,2) 274: (4,3,2)
16: (5) 132: (5,3) 276: (4,2,3)
18: (3,2) 136: (4,4) 288: (3,6)
20: (2,3) 138: (4,2,2) 290: (3,4,2)
32: (6) 144: (3,5) 292: (3,3,3)
34: (4,2) 146: (3,3,2) 296: (3,2,4)
36: (3,3) 148: (3,2,3) 298: (3,2,2,2)
40: (2,4) 160: (2,6) 320: (2,7)
42: (2,2,2) 162: (2,4,2) 322: (2,5,2)
64: (7) 164: (2,3,3) 324: (2,4,3)
66: (5,2) 168: (2,2,4) 328: (2,3,4)
68: (4,3) 170: (2,2,2,2) 330: (2,3,2,2)
72: (3,4) 256: (9) 336: (2,2,5)
74: (3,2,2) 258: (7,2) 338: (2,2,3,2)
(End)

Crossrefs

Equals 2 * A003714.
Compositions with no ones are counted by A212804.
All of the following pertain to compositions in standard order (A066099):
- Length is A000120.
- Compositions without terms > 2 are A003754.
- Compositions without ones are A022340 (this sequence).
- Sum is A070939.
- Compositions with no twos are A175054.
- Strict compositions are A233564.
- Constant compositions are A272919.
- Normal compositions are A333217.
- Runs-resistance is A333628.

Programs

  • Haskell
    a022340 = (* 2) . a003714 -- Reinhard Zumkeller, Feb 03 2015
    
  • Mathematica
    f[n_Integer] := Block[{k = Ceiling[ Log[ GoldenRatio, n*Sqrt[5]]], t = n, fr = {}}, While[k > 1, If[t >= Fibonacci[k], AppendTo[fr, 1]; t = t - Fibonacci[k], AppendTo[fr, 0]]; k-- ]; FromDigits[fr, 2]]; Select[f /@ Range[0, 95], EvenQ[ # ] &] (* Robert G. Wilson v, Sep 18 2004 *)
    Select[Range[2, 512, 2], BitAnd[#, 2#] == 0 &] (* Alonso del Arte, Jun 18 2012 *)
  • Python
    from itertools import count, islice
    def A022340_gen(startvalue=0): # generator of terms >= startvalue
        return filter(lambda n:not n&(n>>1),count(max(0,startvalue+(startvalue&1)),2))
    A022340_list = list(islice(A022340_gen(),30)) # Chai Wah Wu, Sep 07 2022
    
  • Python
    def A022340(n):
        tlist, s = [1,2], 0
        while tlist[-1]+tlist[-2] <= n: tlist.append(tlist[-1]+tlist[-2])
        for d in tlist[::-1]:
            if d <= n:
                s += 1
                n -= d
            s <<= 1
        return s # Chai Wah Wu, Apr 24 2025

Formula

For n>0, a(F(n))=2^n, a(F(n)-1)=A001045(n+2)-1, where F(n) is the n-th Fibonacci number with F(0)=F(1)=1.
a(n) + a(n)/2 = a(n) XOR a(n)/2, see A106409. - Reinhard Zumkeller, May 02 2005

Extensions

Edited by Ralf Stephan, Sep 01 2004

A169813 a(n) = n XOR sigma(n), where sigma(n) is the number of divisors of n, A000203.

Original entry on oeis.org

0, 1, 7, 3, 3, 10, 15, 7, 4, 24, 7, 16, 3, 22, 23, 15, 3, 53, 7, 62, 53, 50, 15, 36, 6, 48, 51, 36, 3, 86, 63, 31, 17, 20, 19, 127, 3, 26, 31, 114, 3, 74, 7, 120, 99, 102, 31, 76, 8, 111, 123, 86, 3, 78, 127, 64, 105, 96, 7, 148, 3, 94, 87, 63, 21, 210, 7, 58, 37, 214, 15, 139, 3, 56
Offset: 1

Views

Author

N. J. A. Sloane, May 28 2010

Keywords

Crossrefs

Programs

A318507 a(n) = A032742(n) XOR A001065(n)-A032742(n), where XOR is bitwise-or (A003987) and A001065 = sum of proper divisors and A032742 = the largest proper divisor of n.

Original entry on oeis.org

1, 1, 1, 3, 1, 0, 1, 7, 2, 6, 1, 12, 1, 4, 1, 15, 1, 5, 1, 6, 3, 8, 1, 20, 4, 14, 13, 0, 1, 20, 1, 31, 15, 18, 1, 55, 1, 16, 9, 10, 1, 52, 1, 4, 29, 20, 1, 44, 6, 11, 21, 14, 1, 60, 13, 56, 23, 30, 1, 80, 1, 28, 1, 63, 11, 12, 1, 58, 19, 4, 1, 115, 1, 38, 1, 60, 3, 20, 1, 106, 22, 42, 1, 72, 23, 40, 25, 28, 1, 78, 5, 48, 27, 44, 21, 92, 1
Offset: 1

Views

Author

Antti Karttunen, Aug 28 2018

Keywords

Comments

Note that here zeros occur only on even perfect numbers (even terms of A000396), in contrast to A318457, which would be zero also for any hypothetical odd perfect number. - Antti Karttunen, Aug 29 2018

Crossrefs

Programs

Formula

a(n) = A003987(A032742(n), A318505(n)).
For n > 1, a(n) = A001065(n) - 2*A318508(n).

A318517 a(n) = A032742(n) XOR n-A032742(n), where XOR is bitwise-xor (A003987) and A032742 = the largest proper divisor of n.

Original entry on oeis.org

1, 0, 3, 0, 5, 0, 7, 0, 5, 0, 11, 0, 13, 0, 15, 0, 17, 0, 19, 0, 9, 0, 23, 0, 17, 0, 27, 0, 29, 0, 31, 0, 29, 0, 27, 0, 37, 0, 23, 0, 41, 0, 43, 0, 17, 0, 47, 0, 45, 0, 51, 0, 53, 0, 39, 0, 53, 0, 59, 0, 61, 0, 63, 0, 57, 0, 67, 0, 57, 0, 71, 0, 73, 0, 43, 0, 73, 0, 79, 0, 45, 0, 83, 0, 85, 0, 39, 0, 89, 0, 67, 0, 33, 0, 95
Offset: 1

Views

Author

Antti Karttunen, Aug 28 2018

Keywords

Crossrefs

Programs

Formula

a(n) = A003987(A032742(n), A060681(n)).
a(n) = n - 2*A318518(n).

A318514 a(n) = n OR (greatest proper divisor of n).

Original entry on oeis.org

1, 3, 3, 6, 5, 7, 7, 12, 11, 15, 11, 14, 13, 15, 15, 24, 17, 27, 19, 30, 23, 31, 23, 28, 29, 31, 27, 30, 29, 31, 31, 48, 43, 51, 39, 54, 37, 55, 47, 60, 41, 63, 43, 62, 47, 63, 47, 56, 55, 59, 51, 62, 53, 63, 63, 60, 59, 63, 59, 62, 61, 63, 63, 96, 77, 99, 67, 102, 87, 103, 71, 108, 73, 111, 91, 110, 79, 111, 79, 120, 91, 123, 83, 126
Offset: 1

Views

Author

Antti Karttunen, Aug 28 2018

Keywords

Crossrefs

Programs

Formula

a(n) = A003986(n, A032742(n)).
a(n) = n + A032742(n) - A318515(n).

A318515 a(n) = n AND A032742(n), where AND is bitwise-and (A004198) and A032742 = the largest proper divisor of n.

Original entry on oeis.org

1, 0, 1, 0, 1, 2, 1, 0, 1, 0, 1, 4, 1, 6, 5, 0, 1, 0, 1, 0, 5, 2, 1, 8, 1, 8, 9, 12, 1, 14, 1, 0, 1, 0, 3, 0, 1, 2, 5, 0, 1, 0, 1, 4, 13, 6, 1, 16, 1, 16, 17, 16, 1, 18, 3, 24, 17, 24, 1, 28, 1, 30, 21, 0, 1, 0, 1, 0, 5, 2, 1, 0, 1, 0, 9, 4, 9, 6, 1, 0, 17, 0, 1, 0, 17, 2, 21, 8, 1, 8, 9, 12, 29, 14, 19, 32, 1, 32, 33, 32, 1, 34, 1, 32, 33
Offset: 1

Views

Author

Antti Karttunen, Aug 28 2018

Keywords

Crossrefs

Programs

Formula

a(n) = A004198(n, A032742(n)).
a(n) = n + A032742(n) - A318514(n) = (n+A032742(n)-A106409(n))/2.

A318504 SumXOR of divisors of n, up to, but not including the second largest of them A032742(n); a(1) = 0 by convention.

Original entry on oeis.org

0, 0, 0, 1, 0, 3, 0, 3, 1, 3, 0, 4, 0, 3, 2, 7, 0, 6, 0, 2, 2, 3, 0, 10, 1, 3, 2, 0, 0, 9, 0, 15, 2, 3, 4, 7, 0, 3, 2, 0, 0, 15, 0, 12, 14, 3, 0, 22, 1, 12, 2, 10, 0, 29, 4, 6, 2, 3, 0, 26, 0, 3, 12, 31, 4, 27, 0, 22, 2, 5, 0, 5, 0, 3, 8, 20, 6, 17, 0, 4, 11, 3, 0, 14, 4, 3, 2, 18, 0, 3, 6, 16, 2, 3, 4, 46, 0, 10, 0, 5, 0, 53, 0, 24, 26
Offset: 1

Views

Author

Antti Karttunen, Aug 28 2018

Keywords

Crossrefs

Programs

  • PARI
    A032742(n) = if(1==n,n,n/vecmin(factor(n)[,1]));
    A318504(n) = { my(v=0); fordiv(n,d,if(d<A032742(n), v = bitxor(v,d))); (v); };

Formula

a(n) = A032742(n) XOR A227320(n).
For n > 1, a(n) = A106409(n) XOR A178910(n).
Showing 1-8 of 8 results.