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.

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

This page as a plain text file.
%I A030103 #28 Aug 07 2024 03:37:59
%S A030103 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,
%T A030103 57,13,29,45,61,2,18,34,50,6,22,38,54,10,26,42,58,14,30,46,62,3,19,35,
%U A030103 51,7,23,39,55,11,27,43,59,15,31,47,63,1,65,129,193,17,81,145,209,33,97,161
%N A030103 Base 4 reversal of n (written in base 10).
%H A030103 Reinhard Zumkeller, <a href="/A030103/b030103.txt">Table of n, a(n) for n = 0..10000</a>
%t A030103 IntegerReverse[Range[0, 100], 4] (* _Paolo Xausa_, Aug 07 2024 *)
%o A030103 (Haskell)
%o A030103 import Data.List (unfoldr)
%o A030103 a030103 n = foldl (\v d -> 4*v + d) 0 $ unfoldr dig n where
%o A030103     dig x = if x == 0 then Nothing else Just $ swap $ divMod x 4
%o A030103 -- _Reinhard Zumkeller_, Oct 10 2011
%o A030103 (PARI) a(n,b=4)=subst(Polrev(base(n,b)),x,b) /* where */
%o A030103 base(n,b)={my(a=[n%b]);while(0<n\=b,a=concat(n%b,a));a}  \\ _M. F. Hasler_, Nov 04 2011
%o A030103 (MIT/GNU Scheme)
%o A030103 (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))))
%o A030103 (define (bit_i n i) (modulo (floor->exact (/ n (expt 2 i))) 2))
%o A030103 ;; The functional add implements sum_{i=lowlim..uplim} intfun(i):
%o A030103 (define (add intfun lowlim uplim) (let sumloop ((i lowlim) (res 0)) (cond ((> i uplim) res) (else (sumloop (1+ i) (+ res (intfun i)))))))
%o A030103 ;; _Antti Karttunen_, Oct 30 2013
%Y A030103 Cf. A004086, A030101 - A030108, A048703, A055948, A035524.
%K A030103 nonn,base,look,easy
%O A030103 0,3
%A A030103 _David W. Wilson_