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

A044051 a(n) = (s(n)+1)/2, where s=A006995 (base-2 palindromes).

Original entry on oeis.org

1, 2, 3, 4, 5, 8, 9, 11, 14, 16, 17, 23, 26, 32, 33, 37, 43, 47, 50, 54, 60, 64, 65, 77, 83, 95, 98, 110, 116, 128, 129, 137, 149, 157, 163, 171, 183, 191, 194, 202, 214, 222, 228, 236, 248, 256, 257, 281, 293, 317, 323, 347, 359, 383
Offset: 1

Views

Author

Melia Aldridge, ma38(AT)spruce.evansville.edu

Keywords

Comments

A141707(a(n)) = 1. - Reinhard Zumkeller, Apr 20 2015

Crossrefs

Programs

  • Haskell
    a044051 = (`div` 2) . (+ 1) . a006995 . (+ 1)
    -- Reinhard Zumkeller, Apr 20 2015

Formula

Let n >= 3, m=floor(log_2(n)), p=floor((3*2^(m-1)-1)/n); then a(n) = 2^(2*m-2-p) + 1 + p*(1-(-1)^n)*2^(m-1) + (1/2)*Sum_{k=1..m-1-p} (floor((n - (3-p)*2^(m-1))/2^(m-1-k)) mod 2)*(2^k + 2^(2*m-1-p-k)). - Hieronymus Fischer, Feb 18 2012

A141709 Least positive multiple of n which is palindromic in base 2, allowing for leading zeros (or: ignoring trailing zeros).

Original entry on oeis.org

1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 33, 12, 65, 14, 15, 16, 17, 18, 513, 20, 21, 66, 2047, 24, 325, 130, 27, 28, 1421, 30, 31, 32, 33, 34, 455, 36, 2553, 1026, 195, 40, 1025, 42, 129, 132, 45, 4094, 4841, 48, 1421, 650, 51, 260, 3339, 54, 165, 56, 513, 2842, 6077, 60, 427, 62
Offset: 1

Views

Author

M. F. Hasler, Jul 17 2008

Keywords

Comments

Even numbers cannot be palindromic in base 2, unless leading zeros are considered (or, equivalently, resp. more precisely, trailing zeros are discarded). This is done in this version of A141708, which therefore does not need to be restricted to odd n as it has been done for A141707 and A141708.

Crossrefs

Programs

  • Haskell
    a141709 n = until ((== 1) . a178225 . a000265) (+ n) n
    -- Reinhard Zumkeller, Nov 06 2012
  • Mathematica
    notpalbinQ[i_]:=Module[{id=IntegerDigits[i,2]},While[Last[id]==0,id=Most[id]];id!= Reverse[id]]; lm[n_]:=Module[{k=1},While[notpalbinQ[k n],k++];k n]; Array[lm,70] (* Harvey P. Dale, Dec 28 2011 *)
  • PARI
    A141709(n)=forstep(k=n,10^9,n,vecextract(t=binary(k>>valuation(k,2)),"-1..1")-t || return(k))
    

Formula

A178225(A000265(a(n))) = 1. - Reinhard Zumkeller, Nov 06 2012

A141708 Least positive multiple of 2n-1 which is palindromic in base 2.

Original entry on oeis.org

1, 3, 5, 7, 9, 33, 65, 15, 17, 513, 21, 2047, 325, 27, 1421, 31, 33, 455, 2553, 195, 1025, 129, 45, 4841, 1421, 51, 3339, 165, 513, 6077, 427, 63, 65, 1273, 2553, 10437, 73, 975, 231, 1501, 891, 3735, 85, 3219, 2047, 273, 93, 2565, 5917, 99, 23533, 4841, 1365, 107
Offset: 1

Views

Author

M. F. Hasler, Jul 17 2008

Keywords

Comments

Even numbers cannot be palindromic in base 2 (unless leading zeros are considered), that's why we search for odd numbers 2n-1 their smallest multiple k(2n-1) which is palindromic in base 2. Obviously this must always be odd.

Crossrefs

Programs

  • Haskell
    a141708 n = a141707 n * (2 * n - 1) -- Reinhard Zumkeller, Apr 20 2015
    
  • Mathematica
    pal2[n_]:=Module[{k=1},While[IntegerDigits[k n,2] != Reverse[ IntegerDigits[ k n,2]],k++];k n]; pal2/@Range[1,121,2] (* Harvey P. Dale, Feb 29 2012 *)
  • PARI
    A141708(n,L=10^9)={ n=2*n-1; forstep(k=1,L,2, binary(k*n)-vecextract(binary(k*n),"-1..1") || return(k*n))}
    
  • Python
    def binpal(n): b = bin(n)[2:]; return b == b[::-1]
    def a(n):
        m = 2*n - 1
        km = m
        while not binpal(km): km += m
        return km
    print([a(n) for n in range(1, 55)]) # Michael S. Branicky, Mar 20 2022

Formula

a(n) = (2n-1)*A141707(n).
Showing 1-3 of 3 results.