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.

A055944 a(n) = n + (reversal of base-2 digits of n) (written in base 10).

Original entry on oeis.org

0, 2, 3, 6, 5, 10, 9, 14, 9, 18, 15, 24, 15, 24, 21, 30, 17, 34, 27, 44, 25, 42, 35, 52, 27, 44, 37, 54, 35, 52, 45, 62, 33, 66, 51, 84, 45, 78, 63, 96, 45, 78, 63, 96, 57, 90, 75, 108, 51, 84, 69, 102, 63, 96, 81, 114, 63, 96, 81, 114, 75, 108, 93, 126, 65, 130, 99, 164, 85
Offset: 0

Views

Author

Henry Bottomley, Jul 18 2000

Keywords

Comments

If n has an even number of digits in base-2 then a(n) is a multiple of 3.

Crossrefs

Cf. A030101, A035522 (iterated), A055948.

Programs

  • Haskell
    a055944 n = n + a030101 n  -- Reinhard Zumkeller, Nov 14 2011
  • Mathematica
    f[n_] := Block[{id = IntegerDigits[n, 2]}, FromDigits[id + Reverse@id, 2]]; Array[f, 69, 0] (* Robert G. Wilson v, Nov 07 2010 *)
    Array[#+FromDigits[Reverse[IntegerDigits[#,2]],2]&,70,0] (* Harvey P. Dale, Feb 09 2025 *)

Formula

a(n) = n + A030101(n).

A030103 Base 4 reversal of n (written in base 10).

Original entry on oeis.org

0, 1, 2, 3, 1, 5, 9, 13, 2, 6, 10, 14, 3, 7, 11, 15, 1, 17, 33, 49, 5, 21, 37, 53, 9, 25, 41, 57, 13, 29, 45, 61, 2, 18, 34, 50, 6, 22, 38, 54, 10, 26, 42, 58, 14, 30, 46, 62, 3, 19, 35, 51, 7, 23, 39, 55, 11, 27, 43, 59, 15, 31, 47, 63, 1, 65, 129, 193, 17, 81, 145, 209, 33, 97, 161
Offset: 0

Views

Author

Keywords

Crossrefs

Programs

  • Haskell
    import Data.List (unfoldr)
    a030103 n = foldl (\v d -> 4*v + d) 0 $ unfoldr dig n where
        dig x = if x == 0 then Nothing else Just $ swap $ divMod x 4
    -- Reinhard Zumkeller, Oct 10 2011
    
  • Mathematica
    IntegerReverse[Range[0, 100], 4] (* Paolo Xausa, Aug 07 2024 *)
  • PARI
    a(n,b=4)=subst(Polrev(base(n,b)),x,b) /* where */
    base(n,b)={my(a=[n%b]);while(0M. F. Hasler, Nov 04 2011
    (MIT/GNU Scheme)
    (define (A030103 n) (if (zero? n) n (let ((uplim (+ (A000523 n) (- 1 (modulo (A000523 n) 2))))) (add (lambda (i) (* (bit_i n (+ i (expt -1 i))) (expt 2 (- uplim i)))) 0 uplim))))
    (define (bit_i n i) (modulo (floor->exact (/ n (expt 2 i))) 2))
    ;; The functional add implements sum_{i=lowlim..uplim} intfun(i):
    (define (add intfun lowlim uplim) (let sumloop ((i lowlim) (res 0)) (cond ((> i uplim) res) (else (sumloop (1+ i) (+ res (intfun i)))))))
    ;; Antti Karttunen, Oct 30 2013

A035524 Reverse and add (in base 4).

Original entry on oeis.org

1, 2, 4, 5, 10, 20, 25, 50, 85, 170, 340, 425, 850, 1385, 3070, 6140, 10225, 15335, 29410, 65135, 129070, 317675, 1280860, 2163725, 3999775, 7999550, 20321515, 81946460, 138412045, 255852575, 511705150, 1300234475, 5242880860
Offset: 0

Views

Author

Keywords

Crossrefs

Cf. A035522.
Cf. A030103.

Programs

  • Haskell
    a035524 n = a035524_list !! n
    a035524_list = iterate a055948 1
    -- Reinhard Zumkeller, Oct 10 2011
    
  • Mathematica
    nxt4[n_]:=Module[{idn4=IntegerDigits[n,4]},FromDigits[idn4+ Reverse[idn4], 4]]; NestList[nxt4,1,40] (* Harvey P. Dale, May 02 2011 *)
  • Python
    def reversedigits(n, b=10): # reverse digits of n in base b
        x, y = n, 0
        while x >= b:
            x, r = divmod(x, b)
            y = b*y + r
        return b*y + x
    A035524_list, l = [1], 1
    for _ in range(50):
        l += reversedigits(l,4)
        A035524_list.append(l)

Formula

a(n+1) = A055948(a(n)), a(0) = 1. [Reinhard Zumkeller, Oct 10 2011]

Extensions

More terms from Larry Reeves (larryr(AT)acm.org), Sep 22 2000

A319804 a(n) = A319720(n) + A319652(n).

Original entry on oeis.org

0, 2, 4, 6, 5, 10, 15, 20, 10, 15, 20, 25, 15, 20, 25, 30, 17, 25, 42, 59, 25, 42, 59, 76, 42, 59, 67, 84, 59, 76, 84, 92, 34, 42, 50, 67, 42, 59, 67, 84, 50, 67, 84, 101, 67, 84, 101, 109, 51, 59, 67, 75, 59, 76, 84, 92, 67, 84, 101, 109, 75, 92, 109, 126, 65, 85, 150, 215
Offset: 0

Views

Author

Seiichi Manyama, Sep 28 2018

Keywords

Comments

This sequence is different from A055948.

Crossrefs

Base b: A319785 (b=2), A319803 (b=3), this sequence (b=4), A319805 (b=5), A319806 (b=6), A319807 (b=7), A319808 (b=8), A319747 (b=9), A052008 (b=10).

Programs

  • Mathematica
    Table[FromDigits[Reverse[#], 4] + FromDigits[#, 4] & [Sort[IntegerDigits[n, 4]]], {n, 0, 100}] (* Paolo Xausa, Aug 07 2024 *)
  • PARI
    a(n) = my(nd=digits(n, 4)); fromdigits(vecsort(nd), 4) + fromdigits(vecsort(nd,,4), 4); \\ Michel Marcus, Sep 28 2018

A048703 Numbers which in base 4 are palindromes and have an even number of digits.

Original entry on oeis.org

0, 5, 10, 15, 65, 85, 105, 125, 130, 150, 170, 190, 195, 215, 235, 255, 1025, 1105, 1185, 1265, 1285, 1365, 1445, 1525, 1545, 1625, 1705, 1785, 1805, 1885, 1965, 2045, 2050, 2130, 2210, 2290, 2310, 2390
Offset: 0

Views

Author

Antti Karttunen, Mar 07 1999

Keywords

Comments

In quaternary base (base 4) the terms look like 0, 11, 22, 33, 1001, 1111, 1221, 1331, 2002, 2112, 2222, 2332, 3003, 3113, 3223, 3333, 100001, 101101, 102201, ..., which is a subsequence of A118595.
Zero is included as a(0) because we can consider it as having zero digits after leading zeros have been excluded.

Examples

			Each a(n) is obtained by concatenating the original base-4 expansion of n (which comes to the left hand, i.e., the most significant side) with its mirror-image (which comes to the right hand, i.e., the least significant side). For example, for a(4) we have 4 = '10' in base 4, which concatenated with its reversal '01' yields '1001', which when converted back to decimal yields 1*64 + 0*16 + 0*4 + 1*1 = 65, thus a(4)=65.
		

Crossrefs

Subsequence of A014192 (all numbers which are palindromes in base 4, including also those of odd number of digits).
Cf. also A048704 (this sequence divided by 5), A048701 (binary palindromes of even length), A055948, A110591, A118595, A030103, A007090, A000302.

Programs

  • Maple
    A048703(n) := (n) -> (2^(floor_log_2_coarse(n)+1))*n + sum('(bit_i(n, i+((-1)^i))*(2^(floor_log_2_coarse(n)-i)))', 'i'=0..floor_log_2_coarse(n));
    bit_i := (x,i) -> `mod`(floor(x/(2^i)),2);
    # Following is like floor_log_2 but even results are incremented by one:
    floor_log_2_coarse := proc(n) local nn,i: nn := n; for i from -1 to n do if(0 = nn) then RETURN(i+(1-(i mod 2))); fi: nn := floor(nn/2); od: end:
  • Mathematica
    q[n_] := EvenQ[IntegerLength[n, 4]] && PalindromeQ[IntegerDigits[n, 4]]; Select[Range[0, 2400, 5], q] (* Amiram Eldar, May 27 2024 *)
  • Python
    def A048703(n):
        s = bin(n-1)[2:]
        if len(s) % 2: s = '0'+s
        t = [s[i:i+2] for i in range(0,len(s),2)]
        return int(''.join(t+t[::-1]),2) # Chai Wah Wu, Feb 26 2021

Formula

a(0) = 0, and for n >= 1, a(n) = A030103(n) + (n * A000302(A110591(n))). - Antti Karttunen, Oct 30 2013
a(n) = 5*A048704(n). [This is just a consequence of the definition of A048704.] - Antti Karttunen, Jul 25 2013
Showing 1-5 of 5 results.