(Translated by https://www.hiragana.jp/)
A030103 -id:A030103 - OEIS
login
Search: a030103 -id:a030103
     Sort: relevance | references | number | modified | created      Format: long | short | data
Bijective base-4 reverse: a(0) = 0; for n >= 1, a(n) = A030103(A065883(n)) * A234957(n).
+20
5
0, 1, 2, 3, 4, 5, 9, 13, 8, 6, 10, 14, 12, 7, 11, 15, 16, 17, 33, 49, 20, 21, 37, 53, 36, 25, 41, 57, 52, 29, 45, 61, 32, 18, 34, 50, 24, 22, 38, 54, 40, 26, 42, 58, 56, 30, 46, 62, 48, 19, 35, 51, 28, 23, 39, 55, 44, 27, 43, 59, 60, 31, 47, 63, 64, 65, 129, 193, 68, 81, 145, 209, 132, 97, 161, 225, 196, 113, 177, 241, 80, 69
OFFSET
0,3
COMMENTS
Self-inverse permutation of nonnegative integers.
FORMULA
a(0) = 0; for n >= 1, a(n) = A030103(A065883(n)) * A234957(n).
Other identities. For all n >= 0:
a(4*n) = 4*a(n).
PROG
(Scheme)
(define (A264994 n) (if (zero? n) n (* (A030103 (A065883 n)) (A234957 n))))
CROSSREFS
Cf. A264993 (a(3n)/3), A265335 (a(5n)/5).
Cf. also A057889 (base-2), A263273 (base-3), A264995 (base-5), A264979 (base-9).
KEYWORD
nonn,base
AUTHOR
Antti Karttunen, Dec 07 2015
STATUS
approved
Read n backwards (referred to as R(n) in many sequences).
+10
568
0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 1, 11, 21, 31, 41, 51, 61, 71, 81, 91, 2, 12, 22, 32, 42, 52, 62, 72, 82, 92, 3, 13, 23, 33, 43, 53, 63, 73, 83, 93, 4, 14, 24, 34, 44, 54, 64, 74, 84, 94, 5, 15, 25, 35, 45, 55, 65, 75, 85, 95, 6, 16, 26, 36, 46, 56, 66, 76, 86, 96, 7, 17, 27, 37, 47
OFFSET
0,3
COMMENTS
Also called digit reversal of n.
Leading zeros (after the reversal has taken place) are omitted. - N. J. A. Sloane, Jan 23 2017
For n>0: a(a(n)) = n iff n mod 10 != 0. - Reinhard Zumkeller, Mar 10 2002
LINKS
Indranil Ghosh, Table of n, a(n) for n = 0..50000 (first 1001 terms from Franklin T. Adams-Watters)
Dana G. Korssjoen, Biyao Li, Stefan Steinerberger, Raghavendra Tripathi, and Ruimin Zhang, Finding structure in sequences of real numbers via graph theory: a problem list, arXiv:2012.04625 [math.CO], Dec 08 2020.
Michael Penn, A digit moving number puzzle., YouTube video, 2022.
FORMULA
a(n) = d(n,0) with d(n,r) = if n=0 then r, otherwise d(floor(n/10), r*10+(n mod 10)). - Reinhard Zumkeller, Mar 04 2010
a(10*n+x) = x*10^m + a(n) if 10^(m-1) <= n < 10^m and 0 <= x <= 9. - Robert Israel, Jun 11 2015
MAPLE
read transforms; A004086 := digrev; #cf "Transforms" link at bottom of page
A004086:=proc(n) local s, t; if n<10 then n else s:=irem(n, 10, 't'); while t>9 do s:=s*10+irem(t, 10, 't') od: s*10+t fi end; # M. F. Hasler, Jan 29 2012
MATHEMATICA
Table[FromDigits[Reverse[IntegerDigits[n]]], {n, 0, 75}]
IntegerReverse[Range[0, 80]](* Requires Mathematica version 10 or later *) (* Harvey P. Dale, May 13 2018 *)
PROG
(PARI) dig(n) = {local(m=n, r=[]); while(m>0, r=concat(m%10, r); m=floor(m/10)); r}
A004086(n) = {local(b, m, r); r=0; b=1; m=dig(n); for(i=1, matsize(m)[2], r=r+b*m[i]; b=b*10); r} \\ Michael B. Porter, Oct 16 2009
(PARI) A004086(n)=fromdigits(Vecrev(digits(n))) \\ M. F. Hasler, Nov 11 2010, updated May 11 2015, Sep 13 2019
(Haskell) a004086 = read . reverse . show -- Reinhard Zumkeller, Apr 11 2011
(Python)
def A004086(n):
return int(str(n)[::-1]) # Chai Wah Wu, Aug 30 2014
(J) |.&.": i.@- 1e5 NB. Stephen Makdisi, May 14 2018
KEYWORD
nonn,base,nice,look
EXTENSIONS
Extended by Ray Chandler, Dec 30 2004
STATUS
approved
Convert n to base 4, move the most significant digit to the least significant one and convert back to base 10.
+10
14
0, 1, 2, 3, 1, 5, 9, 13, 2, 6, 10, 14, 3, 7, 11, 15, 1, 5, 9, 13, 17, 21, 25, 29, 33, 37, 41, 45, 49, 53, 57, 61, 2, 6, 10, 14, 18, 22, 26, 30, 34, 38, 42, 46, 50, 54, 58, 62, 3, 7, 11, 15, 19, 23, 27, 31, 35, 39, 43, 47, 51, 55, 59, 63, 1, 5, 9, 13, 17, 21, 25
OFFSET
0,3
COMMENTS
a(4*n) = 1.
Fixed points of the transform are listed in A048329.
LINKS
Indranil Ghosh, Table of n, a(n) for n = 0..65536 (terms 0..1000 from Paolo P. Lava)
EXAMPLE
11 in base 4 is 23: moving the most significant digit as the least significant one we have 32 that is 14 in base 10.
MAPLE
with(numtheory): P:=proc(q, h) local a, b, k, n; print(0);
for n from 1 to q do
a:=convert(n, base, h); b:=[]; for k from 1 to nops(a)-1 do b:=[op(b), a[k]]; od; a:=[a[nops(a)], op(b)];
a:=convert(a, base, h, 10); b:=0; for k from nops(a) by -1 to 1 do b:=10*b+a[k]; od;
print(b); od; end: P(10^4, 4);
MATHEMATICA
roll[n_, b_] := Block[{w = IntegerDigits[n, b]}, Append[Rest@ w, First@ w]]; b = 4; FromDigits[#, b] & /@ (roll[#, b] & /@ Range[0, 70]) (* Michael De Vlieger, Mar 04 2015 *)
Table[FromDigits[RotateLeft[IntegerDigits[n, 4]], 4], {n, 0, 70}] (* Harvey P. Dale, Aug 07 2015 *)
PROG
(Python)
def A255689(n):
....x=A007090(n)
....return int (x[1:]+x[0], 4) # Indranil Ghosh, Feb 08 2017
KEYWORD
nonn,easy,base
AUTHOR
Paolo P. Lava, Mar 02 2015
STATUS
approved
Reverse and add (in base 4).
+10
7
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,2
FORMULA
a(n+1) = A055948(a(n)), a(0) = 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 *)
PROG
(Haskell)
a035524 n = a035524_list !! n
a035524_list = iterate a055948 1
-- Reinhard Zumkeller, Oct 10 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)
CROSSREFS
Cf. A035522.
Cf. A030103.
KEYWORD
nonn,easy,nice,base
EXTENSIONS
More terms from Larry Reeves (larryr(AT)acm.org), Sep 22 2000
STATUS
approved
n + reversal of base 4 digits of n (written in base 10).
+10
6
0, 2, 4, 6, 5, 10, 15, 20, 10, 15, 20, 25, 15, 20, 25, 30, 17, 34, 51, 68, 25, 42, 59, 76, 33, 50, 67, 84, 41, 58, 75, 92, 34, 51, 68, 85, 42, 59, 76, 93, 50, 67, 84, 101, 58, 75, 92, 109, 51, 68, 85, 102, 59, 76, 93, 110, 67, 84, 101, 118, 75, 92, 109, 126, 65, 130, 195
OFFSET
0,2
COMMENTS
If n has an even number of digits in base 4 then a(n) is a multiple of 5.
FORMULA
a(n) = n + A030103(n).
MATHEMATICA
Table[n+FromDigits[Reverse[IntegerDigits[n, 4]], 4], {n, 0, 70}] (* Harvey P. Dale, Nov 24 2021 *)
PROG
(Haskell)
a055948 n = n + a030103 n
-- Reinhard Zumkeller, Oct 10 2011
CROSSREFS
Cf. A035524 (iterated).
KEYWORD
base,nonn,look
AUTHOR
Henry Bottomley, Jul 18 2000
STATUS
approved
Numbers which in base 4 are palindromes and have an even number of digits.
+10
4
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,2
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.
LINKS
Amiram Eldar, Table of n, a(n) for n = 0..10000 (terms 0..4095 from Antti Karttunen)
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
EXAMPLE
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.
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 *)
PROG
(MIT/GNU Scheme)
(define (A048703 n) (if (zero? n) n (let ((uplim (+ (A000523 n) (- 1 (modulo (A000523 n) 2))))) (+ (* (expt 2 (+ 1 uplim)) n) (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)))))))
;; Another version based on using A030103:
(define (A048703v2 n) (if (zero? n) n (+ (* (A000302 (A110591 n)) n) (A030103 n))))
(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
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.
KEYWORD
nonn,base
AUTHOR
Antti Karttunen, Mar 07 1999
STATUS
approved
Convert n to base 4, move the least significant digit to the most significant one and convert back to base 10.
+10
3
0, 1, 2, 3, 1, 5, 9, 13, 2, 6, 10, 14, 3, 7, 11, 15, 4, 20, 36, 52, 5, 21, 37, 53, 6, 22, 38, 54, 7, 23, 39, 55, 8, 24, 40, 56, 9, 25, 41, 57, 10, 26, 42, 58, 11, 27, 43, 59, 12, 28, 44, 60, 13, 29, 45, 61, 14, 30, 46, 62, 15, 31, 47, 63, 16, 80, 144, 208, 17, 81
OFFSET
0,3
COMMENTS
Fixed points of the transform are listed in A048329.
LINKS
Indranil Ghosh, Table of n, a(n) for n = 0..16384 (terms 0..1000 from Paolo P. Lava)
FORMULA
a(4*k) = k.
a(4^k) = 4^(k-1).
EXAMPLE
11 in base 4 is 23: moving the least significant digit to the most significant one we have 32 that is 14 in base 10.
MAPLE
with(numtheory): P:=proc(q, h) local a, b, k, n; print(0);
for n from 1 to q do
a:=convert(n, base, h); b:=[]; for k from 2 to nops(a) do b:=[op(b), a[k]]; od; a:=[op(b), a[1]];
a:=convert(a, base, h, 10); b:=0; for k from nops(a) by -1 to 1 do b:=10*b+a[k]; od;
print(b); od; end: P(10^4, 4);
MATHEMATICA
roll[n_, b_] := Block[{w = IntegerDigits[n, b]}, Prepend[Most@ w, Last@ w]]; b = 4; FromDigits[#, b] & /@ (roll[#, b] & /@ Range[0, 69]) (* Michael De Vlieger, Mar 04 2015 *)
Array[FromDigits[RotateRight[IntegerDigits[#, 4]], 4]&, 70, 0] (* Harvey P. Dale, Mar 01 2016 *)
PROG
(Python)
def A255589(n):
....x=str(A007090(n))
....return int(x[-1]+x[:-1], 4) # Indranil Ghosh, Feb 03 2017
KEYWORD
nonn,easy,base
AUTHOR
Paolo P. Lava, Mar 02 2015
STATUS
approved
Base-10 numbers k whose number of divisors equals the number of divisors in R(k), where k is written in all bases from base-2 to base-10 and R(k), the digit reversal of k, is read as a number in the same base.
+10
3
1, 9077, 10523, 10838, 30182, 58529, 73273, 77879, 83893, 244022, 303253, 303449, 304853, 329893, 332249, 334001, 334417, 335939, 336083, 346741, 374617, 391187, 504199, 512695, 516982, 595274, 680354, 687142, 758077, 780391, 792214, 854669, 946217, 948539, 995761, 1008487, 1377067, 1389341
OFFSET
1,2
COMMENTS
There are 633 terms below 50 million and 1253 terms below 100 million. All of those have tau(k), the number of divisors of k, equal to 1, 2, 4, 8 or 16. The first term where tau(k) = 2 is n = 93836531, a prime, which is also the first term of A136634. All terms in A136634 will appear in this sequence, as will all terms in A228768(n) for n>=10. The first term with tau(k) = 4 is 9077, the first with tau(k) = 8 is 595274, and the first with tau(k) = 16 is 5170182. It is possible tau(k) must equal 2^i, with i>=0, although this is unknown.
All known terms are squarefree. - Michel Marcus, Jul 07 2021
LINKS
EXAMPLE
9077 is a term as the number of divisors of 9077 = tau(9077) = 4, and this equals the number of divisors of R(9077) when written and then read as a base-j number, with 2 <= j <= 10. See the table below for k = 9077.
.
base | k_base | R(k_base) | R(k_base)_10 | tau(R(k_base)_10)
----------------------------------------------------------------------------------
2 | 10001101110101 | 10101110110001 | 11185 | 4
3 | 110110012 | 210011011 | 15421 | 4
4 | 2031311 | 1131302 | 6002 | 4
5 | 242302 | 203242 | 6697 | 4
6 | 110005 | 500011 | 38887 | 4
7 | 35315 | 51353 | 12533 | 4
8 | 21565 | 56512 | 23882 | 4
9 | 13405 | 50431 | 33157 | 4
10 | 9077 | 7709 | 7709 | 4
MATHEMATICA
Select[Range@100000, Length@Union@DivisorSigma[0, Join[{s=#}, FromDigits[Reverse@IntegerDigits[s, #], #]&/@Range[2, 10]]]==1&] (* Giorgos Kalogeropoulos, Jul 06 2021 *)
PROG
(PARI) isok(k) = {my(t= numdiv(k)); for (b=2, 10, my(d=digits(k, b)); if (numdiv(fromdigits(Vecrev(d), b)) != t, return (0)); ); return(1); } \\ Michel Marcus, Jul 06 2021
CROSSREFS
Cf. A136634 (prime terms), A228768.
Subsequence of A062895.
KEYWORD
nonn,base
AUTHOR
Scott R. Shannon, Jul 05 2021
STATUS
approved
Triangle G(n,k): the value of n written in base k with digits reversed (but written here in base 10) for 2 <= k <= n.
+10
2
1, 3, 1, 1, 4, 1, 5, 7, 5, 1, 3, 2, 9, 6, 1, 7, 5, 13, 11, 7, 1, 1, 8, 2, 16, 13, 8, 1, 9, 1, 6, 21, 19, 15, 9, 1, 5, 10, 10, 2, 25, 22, 17, 10, 1, 13, 19, 14, 7, 31, 29, 25, 19, 11, 1, 3, 4, 3, 12, 2, 36, 33, 28, 21, 12, 1, 11, 13, 7, 17, 8, 43, 41, 37, 31, 23, 13, 1, 7, 22, 11, 22, 14, 2, 49, 46, 41, 34, 25, 14, 1, 15, 7, 15, 3
OFFSET
2,2
EXAMPLE
The triangle starts
1;
3, 1;
1, 4, 1;
5, 7, 5, 1;
3, 2, 9, 6, 1;
MAPLE
A191780 := proc(n, k) d := ListTools[Reverse](convert(n, base, k)) ; add( op(i, d)*k^(i-1), i=1..nops(d)) ;
end proc: # R. J. Mathar, Aug 26 2011
MATHEMATICA
G[n_, k_] := IntegerDigits[n, k] // Reverse // FromDigits[#, k]&; Table[ G[n, k], {n, 2, 15}, {k, 2, n}] // Flatten (* Jean-François Alcover, Feb 10 2018 *)
CROSSREFS
Cf. A007088..A007095, A030101 (column k=2), A030102 (column k=3), A030103 (column k=4).
KEYWORD
nonn,tabl,base,easy
AUTHOR
EXTENSIONS
Corrected by R. J. Mathar, Aug 26 2011
STATUS
approved
n - reversal of base 4 digits of n (written in base 10).
+10
1
0, 0, 0, 0, 3, 0, -3, -6, 6, 3, 0, -3, 9, 6, 3, 0, 15, 0, -15, -30, 15, 0, -15, -30, 15, 0, -15, -30, 15, 0, -15, -30, 30, 15, 0, -15, 30, 15, 0, -15, 30, 15, 0, -15, 30, 15, 0, -15, 45, 30, 15, 0, 45, 30, 15, 0, 45, 30, 15, 0, 45, 30, 15, 0, 63, 0, -63, -126, 51, -12, -75, -138, 39, -24, -87, -150, 27, -36, -99, -162, 75, 12, -51
OFFSET
0,5
COMMENTS
a(n) is a multiple of 3.
LINKS
FORMULA
a(n) = n - A030103(n).
EXAMPLE
For n = 6, the reversal of base 4 digits of n (written in base 10) is 9. So, a(6) = 6 - 9 = -3. - Indranil Ghosh, Feb 01 2017
MATHEMATICA
Table[n-FromDigits[Reverse[IntegerDigits[n, 4]], 4], {n, 0, 90}] (* Harvey P. Dale, Aug 22 2011 *)
CROSSREFS
KEYWORD
base,sign
AUTHOR
Henry Bottomley, Jul 18 2000
STATUS
approved

Search completed in 0.012 seconds