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

A175297 Convert n to binary. AND each respective digit of binary n and binary A030101(n), where A030101(n) is the reversal of the order of the digits in the binary representation of n (given in decimal). a(n) is the decimal value of the result.

Original entry on oeis.org

1, 0, 3, 0, 5, 2, 7, 0, 9, 0, 9, 0, 9, 6, 15, 0, 17, 0, 17, 4, 21, 4, 21, 0, 17, 10, 27, 4, 21, 14, 31, 0, 33, 0, 33, 0, 33, 0, 33, 0, 33, 0, 33, 12, 45, 12, 45, 0, 33, 18, 51, 0, 33, 18, 51, 0, 33, 18, 51, 12, 45, 30, 63, 0, 65, 0, 65, 0, 65, 0, 65, 8, 73, 8, 73, 8, 73, 8, 73, 0, 65, 0, 65
Offset: 1

Views

Author

Leroy Quet, Mar 24 2010

Keywords

Comments

By "respective" digits of binary n and binary A030101(n), the rightmost digit of A030101(n) ( which is a 1) is AND'ed with the rightmost digit of n. A030101(n) is represented with the appropriate number of leading 0's.

Examples

			20 in binary is 10100. The reversal of the binary digits is 00101. So, from leftmost to rightmost respective digits, we AND 10100 and 00101: 1 AND 0 = 0. 0 AND 0 = 0. 1 AND 1 = 1. 0 AND 0 = 0. And 0 AND 1 = 1. So, 10100 AND 00101 is 100, which is 4 in decimal. So a(20) = 4.
		

Crossrefs

Programs

  • Mathematica
    Table[f = IntegerDigits[x, 2]; f = f + Reverse[f]; FromDigits[ Table[If[f[[r]] == 2, 1, 0], {r, 1, Length[f]}], 2], {x, 83}] (* Dylan Hamilton, Oct 15 2010 *)
    Table[With[{d = IntegerDigits[n, 2]}, FromDigits[#, 2] &@ Map[BitAnd @@ # &, Transpose@{d, Reverse@ d}]], {n, 83}] (* Michael De Vlieger, Sep 03 2017 *)

Extensions

Extended, with redundant initial entries included, by Dylan Hamilton, Oct 15 2010

A328106 Binary weight of A327971: a(n) = A000120(A110240(n) XOR A030101(A110240(n))).

Original entry on oeis.org

0, 0, 2, 2, 2, 4, 6, 4, 8, 10, 10, 8, 12, 8, 18, 6, 12, 26, 16, 18, 14, 18, 20, 22, 22, 26, 26, 38, 30, 26, 36, 26, 28, 36, 28, 18, 28, 42, 36, 32, 34, 40, 44, 38, 40, 50, 48, 48, 50, 58, 46, 56, 48, 42, 54, 48, 56, 56, 46, 54, 48, 52, 60, 58, 78, 74, 64, 60, 66, 74, 74, 64, 80, 74, 80, 62, 92, 62, 80, 70, 68, 100, 90, 82, 80, 92
Offset: 0

Views

Author

Antti Karttunen, Oct 05 2019

Keywords

Comments

a(n) is the number of times the k-th cell from the left is different from the k-th cell from the right, at the generation n of Rule 30 1-D cellular automaton, when it is started from a single alive cell.
All terms are even.

Examples

			The evolution of one-dimensional cellular automaton rule 30 proceeds as follows, when started from a single alive (1) cell:
---------------------------------------------- a(n)
   0:              (1)                          0
   1:             1(1)1                         0
   2:            11(0)01                        2
   3:           110(1)111                       2
   4:          1100(1)0001                      2
   5:         11011(1)10111                     4
   6:        110010(0)001001                    6
   7:       1101111(0)0111111                   4
   8:      11001000(1)11000001                  8
   9:     110111101(1)001000111                10
  10:    1100100001(0)1111011001               10
  11:   11011110011(0)10000101111               8
  12:  110010001110(0)110011010001             12
  13: 1101111011001(1)1011100110111             8
When we count the times the k-th cell from the left is different from the k-th cell from the right, we obtain a(n). Note that the central cells (indicated with parentheses) do not affect the count, as the central cell is always equal to itself.
		

Crossrefs

Programs

Formula

a(n) = Sum_{i=0..2n} abs(A070950(n,i)-A070950(n,n-i)).

A081434 Numbers such that RevBinary() = RevDecimal(), where RevDecimal(n) is the decimal reversal of n (A004086) and RevBinary(n) is the binary reversal of n (A030101).

Original entry on oeis.org

0, 1, 3, 5, 7, 9, 33, 92, 99, 313, 585, 717, 732, 759, 957, 5485, 5845, 7447, 9009, 15351, 32223, 39993, 53235, 53835, 71869, 73737, 77360, 96817, 319773, 377913, 585585, 1758571, 1934391, 1979791, 3129213, 5071705, 5259525, 5841485, 13162800
Offset: 1

Views

Author

Reinhard Zumkeller, Mar 20 2003

Keywords

Crossrefs

Programs

  • Mathematica
    Select[Range[0, 100000], SameQ @@ IntegerReverse[#, {2, 10}] &] (* Amiram Eldar, Aug 05 2025 *)
  • PARI
    isok(k) = fromdigits(Vecrev(binary(k)), 2) == fromdigits(Vecrev(digits(k))); \\ Amiram Eldar, Aug 05 2025
  • Python
    def ok(n): return int(bin(n)[:1:-1], 2) == int(str(n)[::-1])
    print([k for k in range(10**7) if ok(k)]) # Michael S. Branicky, Jan 30 2023
    

Formula

A030101(a(n)) = A004086(a(n)).

Extensions

More terms from Harry J. Smith, Dec 19 2007

A266402 Self-inverse permutation of natural numbers: a(n) = A064989(A030101(A003961(n))).

Original entry on oeis.org

1, 2, 3, 4, 5, 6, 11, 8, 17, 10, 7, 12, 13, 14, 25, 38, 9, 30, 23, 20, 53, 34, 19, 36, 15, 26, 51, 28, 29, 18, 37, 76, 33, 22, 83, 24, 31, 16, 39, 40, 47, 42, 59, 46, 75, 44, 41, 218, 73, 122, 27, 52, 21, 188, 107, 56, 101, 58, 43, 100, 89, 74, 397, 152, 65, 66, 109, 134, 131, 70, 71, 514, 49, 62, 45, 32, 239, 78, 97, 120, 563, 82, 35
Offset: 1

Views

Author

Antti Karttunen, Jan 02 2016

Keywords

Comments

Shift primes in the prime factorization of n one step towards larger primes (A003961), then reverse the binary representation of the resulting odd number (with A030101), which yields another (or same) odd number, then shift primes in the prime factorization of that second odd number one step back towards smaller primes (A064989).

Crossrefs

Cf. A265329, A266404 (other conjugates or similar sequences derived from A057889).
Cf. also A266401, A266415, A266416.

Programs

  • Mathematica
    f[n_] := Times @@ Power[Which[# == 1, 1, # == 2, 1, True, NextPrime[#, -1]] & /@ First@ #, Last@ #] &@ Transpose @FactorInteger@ n; g[n_] := FromDigits[Reverse@ IntegerDigits[n, 2], 2] 2^IntegerExponent[n, 2]; h[p_?PrimeQ] := h[p] = Prime[PrimePi@ p + 1]; h[1] = 1; h[n_] := h[n] = Times @@ (h[First@ #]^Last@ # &) /@ FactorInteger@ n; Table[f@ g@ h@ n, {n, 83}] (* A266402, after Jean-François Alcover at A003961 and Ivan Neretin at A057889 *)
  • PARI
    A030101(n) = if(n<1,0,subst(Polrev(binary(n)),x,2));
    A003961(n) = my(f = factor(n)); for (i=1, #f~, f[i, 1] = nextprime(f[i, 1]+1)); factorback(f); \\ Using code of Michel Marcus
    A064989(n) = {my(f); f = factor(n); if((n>1 && f[1,1]==2), f[1,2] = 0); for (i=1, #f~, f[i,1] = precprime(f[i,1]-1)); factorback(f)};
    A266402 = n -> A064989(A030101(A003961(n)));
    for(n=1, 8191, write("b266402.txt", n, " ", A266402(n)));
    
  • Scheme
    (define (A266402 n) (A064989 (A057889 (A003961 n))))

Formula

Other identities. For all n >= 0:
A000035(a(n)) = A000035(n). [This permutation preserves the parity of n.]

A266404 Self-inverse permutation of natural numbers: a(n) = A250470(A030101(A250469(n))).

Original entry on oeis.org

1, 2, 3, 4, 5, 6, 11, 8, 17, 10, 7, 12, 13, 20, 25, 16, 9, 18, 23, 14, 53, 22, 19, 28, 15, 36, 27, 24, 29, 40, 37, 32, 33, 34, 83, 26, 31, 42, 51, 30, 47, 38, 59, 44, 101, 76, 41, 60, 73, 68, 39, 52, 21, 84, 107, 56, 131, 72, 43, 48, 89, 80, 125, 64, 65, 66, 109, 50, 99, 82, 71, 58, 49, 74, 151, 46, 239, 78, 97, 62, 173, 70, 35, 54
Offset: 1

Views

Author

Antti Karttunen, Jan 02 2016

Keywords

Crossrefs

Cf. A265329, A266402 (other conjugates or similar derivations of A057889).
Cf. also A266403.

Programs

Formula

Other identities. For all n >= 0:
A000035(a(n)) = A000035(n). [This permutation preserves the parity of n.]

A144078 a(n) = the number of digits in the binary representation of n that differ from the corresponding digit in the binary reversal of n. (I.e., a(n) = number of 1's in n XOR A030101(n).)

Original entry on oeis.org

0, 2, 0, 2, 0, 2, 0, 2, 0, 4, 2, 4, 2, 2, 0, 2, 0, 4, 2, 2, 0, 4, 2, 4, 2, 2, 0, 4, 2, 2, 0, 2, 0, 4, 2, 4, 2, 6, 4, 4, 2, 6, 4, 2, 0, 4, 2, 4, 2, 2, 0, 6, 4, 4, 2, 6, 4, 4, 2, 4, 2, 2, 0, 2, 0, 4, 2, 4, 2, 6, 4, 2, 0, 4, 2, 4, 2, 6, 4, 4, 2, 6, 4, 2, 0, 4, 2, 4, 2, 6, 4, 2, 0, 4, 2, 4, 2, 2, 0, 6, 4, 4, 2, 4, 2
Offset: 1

Views

Author

Leroy Quet, Sep 09 2008

Keywords

Comments

a(n) + A144079(n) = A070939(n), the number of binary digits in n.

Examples

			20 in binary is 10100. Compare this with its digit reversal, 00101. XOR each pair of corresponding digits: 1 XOR 0 = 1, 0 XOR 0 = 0, 1 XOR 1 = 0, 0 XOR 0 = 0, 0 XOR 1 = 1. There are two bit pairs that differ, so a(20) = 2.
		

Crossrefs

Programs

  • Maple
    A144078 := proc(n) local a,dgs,i; a := 0 ; dgs := convert(n,base,2) ; for i from 1 to nops(dgs) do if op(i,dgs)+op(-i,dgs) = 1 then a := a+1 ; fi; od; RETURN(a) ; end: for n from 1 to 240 do printf("%d,",A144078(n)) ; od: # R. J. Mathar, Sep 14 2008
  • Mathematica
    brd[n_]:=Module[{idn2=IntegerDigits[n,2]},Count[Transpose[{idn2, Reverse[ idn2]}], ?(#[[1]]!=#[[2]]&)]]; Array[brd,110] (* _Harvey P. Dale, May 09 2016 *)
  • PARI
    a(n) = hammingweight(bitxor(n, fromdigits(Vecrev(binary(n)),2))) \\ Rémy Sigrist, Oct 07 2018

Formula

From Rémy Sigrist, Oct 07 2018: (Start)
a(n) = 0 iff n is a binary palindrome (A006995).
a(A143960(n)) = 2*n (in fact A143960(n) is the least k such that a(k) = 2*n).
(End)

Extensions

More terms from R. J. Mathar, Sep 14 2008

A175919 Convert n to binary. XOR each respective digit of binary n and binary A030101(n), where A030101(n) is the reversal of the order of the digits in the binary representation of n (given in decimal). a(n) is the decimal value of the result.

Original entry on oeis.org

0, 0, 3, 0, 5, 0, 5, 0, 9, 0, 15, 6, 15, 6, 9, 0, 17, 0, 27, 10, 17, 0, 27, 10, 27, 10, 17, 0, 27, 10, 17, 0, 33, 0, 51, 18, 45, 12, 63, 30, 45, 12, 63, 30, 33, 0, 51, 18, 51, 18, 33, 0, 63, 30, 45, 12, 63, 30, 45, 12, 51, 18, 33, 0, 65, 0, 99, 34, 85, 20, 119, 54, 65, 0, 99, 34, 85, 20, 119
Offset: 0

Views

Author

Dylan Hamilton, Oct 15 2010

Keywords

Comments

Description format taken from Leroy Quet's OR and AND gate sequences for consistency.

Crossrefs

Or A175298 and And A175297 gate sequences. The rest of the equivalent sequences for other gates are adjacent.

Programs

  • Mathematica
    Table[f = IntegerDigits[x, 2]; f = f + Reverse[f]; FromDigits[ Table[If[OddQ[f[[r]]], 1, 0], {r, 1, Length[f]}], 2], {x, STARTPOINT,ENDPOINT}]

Formula

a(n) = A003987(n, A030101(n)).

A081431 RevBinary(RevDecimal(n)), where RevBinary(m) is the binary reversal of m (A030101) and RevDecimal(m) is the decimal reversal of m (A004086).

Original entry on oeis.org

0, 1, 1, 3, 1, 5, 3, 7, 1, 9, 1, 13, 21, 31, 37, 51, 47, 113, 69, 109, 1, 3, 13, 1, 21, 11, 31, 9, 37, 29, 3, 11, 29, 33, 53, 43, 63, 73, 101, 93, 1, 7, 3, 17, 13, 27, 1, 41, 21, 61, 5, 15, 19, 49, 45, 59, 65, 105, 85, 125, 3, 1, 11, 9, 29, 7, 33, 25, 53, 3, 7, 17, 27, 41
Offset: 0

Views

Author

Reinhard Zumkeller, Mar 20 2003

Keywords

Crossrefs

Programs

  • Mathematica
    Table[IntegerReverse[IntegerReverse[n],2],{n,0,80}] (* Requires Mathematica version 10 or later *) (* Harvey P. Dale, Dec 03 2018 *)
  • PARI
    a(n) = fromdigits(Vecrev(binary(fromdigits(Vecrev(digits(n))))), 2); \\ Michel Marcus, Jan 30 2023
  • Python
    def a(n): return int(bin(int(str(n)[::-1]))[:1:-1], 2)
    print([a(n) for n in range(74)]) # Michael S. Branicky, Jan 30 2023
    

Formula

a(n) = A030101(A004086(n)). - Michel Marcus, Jan 30 2023

A081432 RevDecimal(RevBinary(n)), where RevDecimal(m) is the decimal reversal of m (A004086) and RevBinary(m) is the binary reversal of m (A030101).

Original entry on oeis.org

0, 1, 1, 3, 1, 5, 3, 7, 1, 9, 5, 31, 3, 11, 7, 51, 1, 71, 9, 52, 5, 12, 31, 92, 3, 91, 11, 72, 7, 32, 51, 13, 1, 33, 71, 94, 9, 14, 52, 75, 5, 73, 12, 35, 31, 54, 92, 16, 3, 53, 91, 15, 11, 34, 72, 95, 7, 93, 32, 55, 51, 74, 13, 36, 1, 56, 33, 79, 71, 18, 94, 311, 9, 37, 14
Offset: 0

Views

Author

Reinhard Zumkeller, Mar 20 2003

Keywords

Crossrefs

Programs

  • Mathematica
    IntegerReverse[IntegerReverse[Range[0,80],2]] (* Requires Mathematica version 10 or later *) (* Harvey P. Dale, Oct 03 2017 *)
  • PARI
    a(n) = fromdigits(Vecrev(digits(fromdigits(Vecrev(binary(n)), 2)))); \\ Michel Marcus, Jan 30 2023
  • Python
    def a(n): return int(str(int(bin(n)[:1:-1], 2))[::-1])
    print([a(n) for n in range(75)]) # Michael S. Branicky, Jan 30 2023
    

Formula

a(n) = A004086(A030101(n)). - Michel Marcus, Jan 30 2023

A081433 Numbers n such that RevBinary(RevDecimal(n))=RevDecimal(RevBinary(n)), where RevDecimal(n) is the decimal reversal of n (A004086) and RevBinary(n) is the binary reversal of n (A030101).

Original entry on oeis.org

0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 15, 33, 51, 66, 99, 165, 313, 516, 535, 561, 585, 615, 626, 717, 759, 858, 929, 957, 1241, 1421, 2112, 2482, 2552, 2842, 3579, 4224, 5485, 5845, 6336, 7447, 8448, 9009, 9753, 11051, 12631, 13621, 15011, 15351, 15375
Offset: 1

Views

Author

Reinhard Zumkeller, Mar 20 2003

Keywords

Comments

A030101(A004086(a(n)))=A004086(A030101(a(n))), A081431(a(n))=A081432(a(n)).

Crossrefs

Programs

  • Python
    def ok(n): return int(bin(int(str(n)[::-1]))[:1:-1], 2) == int(str(int(bin(n)[:1:-1], 2))[::-1])
    print([k for k in range(2**14) if ok(k)]) # Michael S. Branicky, Jan 30 2023
Showing 1-10 of 197 results. Next