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

A159780 Inner product of the binary representation of n and its reverse.

Original entry on oeis.org

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

Views

Author

T. D. Noe, Apr 22 2009

Keywords

Comments

a(n) gives the number of 1's that coincide in the binary representation of n and its reverse. For the n in A140900, we have a(n)=0. The number k first appears at n=2^k-1.
Also central terms and right edge of the triangle in A173920: a(n)=A173920(2*n,n)=A173920(n,n). [From Reinhard Zumkeller, Mar 04 2010]
a(A000225(n)) = n and a(m) < n for m < A000225(n). [Reinhard Zumkeller, Oct 21 2011]
a(n) = sum(A030308(n,k)*A030308(n,A070939(n)-1-k): k = 0..A070939(n)-1). - Reinhard Zumkeller, Mar 10 2013

Examples

			14 is represented by the binary vector (1,1,1,0). The reverse is (0,1,1,1). The inner product is 1*0+1*1+1*1+0*1 = 2. Hence a(14) = 2.
		

Crossrefs

Cf. A216176.

Programs

  • Haskell
    a159780 n = sum $ zipWith (*) bs $ reverse bs
       where bs = a030308_row n
    -- Reinhard Zumkeller, Mar 10 2013, Oct 21 2011
  • Mathematica
    Table[d=IntegerDigits[n,2]; d.Reverse[d], {n,0,1023}]

A343452 Numbers k such that A085942(k) = 0.

Original entry on oeis.org

0, 10, 20, 30, 40, 50, 60, 70, 80, 90, 100, 200, 300, 400, 500, 600, 700, 800, 900, 1000, 1010, 1020, 1030, 1040, 1050, 1060, 1070, 1080, 1090, 1100, 1200, 1300, 1400, 1500, 1600, 1700, 1800, 1900, 2000, 2010, 2020, 2030, 2040, 2050, 2060, 2070, 2080, 2090
Offset: 1

Views

Author

Rémy Sigrist, May 21 2021

Keywords

Comments

This sequence is the decimal analog of A140900.

Examples

			A085942(1020) = 1*0 + 0*2 + 2*0 + 0*1 = 0, so 1020 belongs to this sequence.
A085942(1021) = 1*1 + 0*2 + 2*0 + 1*1 = 2, so 1021 does not belong to this sequence.
		

Crossrefs

Programs

  • PARI
    is(n) = { my (d=digits(n)); d*Colrev(d)==0 }

A344511 a(n) = Sum_{k >= 0} sign(d_k) * 2^k for any number n with decimal expansion Sum_{k >= 0} d_k * 10^k.

Original entry on oeis.org

0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 2, 3, 3, 3, 3, 3, 3, 3, 3, 3, 2, 3, 3, 3, 3, 3, 3, 3, 3, 3, 2, 3, 3, 3, 3, 3, 3, 3, 3, 3, 2, 3, 3, 3, 3, 3, 3, 3, 3, 3, 2, 3, 3, 3, 3, 3, 3, 3, 3, 3, 2, 3, 3, 3, 3, 3, 3, 3, 3, 3, 2, 3, 3, 3, 3, 3, 3, 3, 3, 3, 2, 3, 3, 3, 3, 3, 3
Offset: 0

Views

Author

Rémy Sigrist, May 21 2021

Keywords

Comments

The binary expansion of a(n) encodes the nonzero digits of the decimal expansion of n.

Examples

			For n = 20!:
- 2432902008176640000 is the decimal expansion of 20!, so
  1111101001111110000 is the binary expansion of a(20!),
- a(20!) = 513008.
		

Crossrefs

Cf. A007088, A140900, A289831 (base-3 analog), A343452.

Programs

  • PARI
    a(n) = fromdigits(apply(sign, digits(n)), 2)
    
  • Python
    def a(n): return int("".join((('1' if d!='0' else '0') for d in str(n))), 2)
    print([a(n) for n in range(87)]) # Michael S. Branicky, May 22 2021

Formula

a(n) belongs to A140900 iff n belongs to A343452.
a(A007088(n)) = n.

A374664 Nonnegative numbers whose binary expansion has no ones in common with some of its cyclic shifts.

Original entry on oeis.org

0, 2, 4, 8, 9, 10, 12, 16, 17, 18, 20, 24, 32, 33, 34, 35, 36, 40, 42, 48, 49, 56, 64, 65, 66, 67, 68, 72, 73, 74, 76, 80, 82, 84, 96, 97, 100, 112, 128, 129, 130, 131, 132, 133, 134, 135, 136, 137, 138, 140, 144, 145, 146, 148, 150, 152, 153, 160, 161, 162
Offset: 1

Views

Author

Rémy Sigrist, Jul 15 2024

Keywords

Comments

Leading zeros in binary expansions are ignored.
All positive terms belong to A072602.
A number k belongs to the sequence iff A001196(k) belongs to the sequence.

Examples

			The first terms, with their binary expansion and an appropriate cyclic shift, are:
  n   a(n)  bin(a(n))  cyc
  --  ----  ---------  ------
   1     0          0       0
   2     2         10      01
   3     4        100     001
   4     8       1000    0001
   5     9       1001    0110
   6    10       1010    0101
   7    12       1100    0011
   8    16      10000   00001
   9    17      10001   00110
  10    18      10010   00101
  11    20      10100   01001
  12    24      11000   00011
  13    32     100000  000001
  14    33     100001  000110
  15    34     100010  000101
  16    35     100011  011100
		

Crossrefs

Programs

  • PARI
    is(n) = { my (x = max(exponent(n), 0), s = n); for (i = 0, x, s = (s >> 1) + if (s%2, 2^x, 0); if (bitand(s, n)==0, return (1););); return (0); }

A370842 Numbers k that can be added without carries to their digit reversal (A004086(k)).

Original entry on oeis.org

0, 1, 2, 3, 4, 10, 11, 12, 13, 14, 15, 16, 17, 18, 20, 21, 22, 23, 24, 25, 26, 27, 30, 31, 32, 33, 34, 35, 36, 40, 41, 42, 43, 44, 45, 50, 51, 52, 53, 54, 60, 61, 62, 63, 70, 71, 72, 80, 81, 90, 100, 101, 102, 103, 104, 105, 106, 107, 108, 110, 111, 112, 113
Offset: 1

Views

Author

Rémy Sigrist, Mar 03 2024

Keywords

Comments

All positive terms belong to A015976.

Examples

			42 belongs to the sequence as 42 + 24 does not lead to carries.
48 does not belong to the sequence as 48 + 84 leads to carries.
		

Crossrefs

Cf. A004086, A015976, A056964, A140900 (base-2 analog).

Programs

  • PARI
    is(n, base = 10) = { my (d = if (n, digits(n, base), [0]), p = d + Vecrev(d)); vecmax(p) < base }
Showing 1-5 of 5 results.