[go: up one dir, main page]

login
Search: a028897 -id:a028897
     Sort: relevance | references | number | modified | created      Format: long | short | data
Nonnegative integers, sorted by increasing value of A028897(n) = Sum d[i]*2^i for n = Sum d[i]*10^i, then value of n.
+20
4
0, 1, 2, 10, 3, 11, 4, 12, 20, 100, 5, 13, 21, 101, 6, 14, 22, 30, 102, 110, 7, 15, 23, 31, 103, 111, 8, 16, 24, 32, 40, 104, 112, 120, 200, 1000, 9, 17, 25, 33, 41, 105, 113, 121, 201, 1001, 18, 26, 34, 42, 50, 106, 114, 122, 130, 202, 210, 1002, 1010, 19, 27
OFFSET
0,3
COMMENTS
A028897(n) is the result of using the decimal digits of n, but weighting their position as in base 2. For sake of brevity we refer to this as the b-value of n in the sequel. This idea is found on the website given in links under the name "decibinary numbers".
The b-values increment by 1 at indices (of "records") 1, 2, 4, 6, 10, 14, 20, 26, 36, ... Prefixing an initial 0, the gaps between these, equal to the number of occurrences of a given b-value (0, 1, 2, ...), are 1, 1, 2, 2, 4, 4, 6, 6, 10, 10, 13, 13, ... = A072170(n,10). In this sequence each of (1, 2, 4, 6, 10, 13, 18, ...) is repeated twice.
LINKS
Robin C. Yu, Decibinary Numbers, on Hackerrank.com.
EXAMPLE
The first terms of the sequence are as follows: (b = A028897)
n | 0 | 1 | 2 | 10 | 3 | 11 | 4 | 12 | 20 | 100 | 5 | 13 | 21 | 101 | ...
----+---+---+---+----+---+----+---+----+----+-----+---+----+----+-----+-----
b(n)| 0 | 1 | 2 | 2 | 3 | 3 | 4 | 4 | 4 | 4 | 5 | 5 | 5 | 5 | ...
For example, b(345) = 3*2^2 + 4*2 + 5 = 25.
MAPLE
N:= 30: # for all numbers with A028897(n) <= N
L:= {seq([i, i], i=0..9)}: Agenda:= {seq([i, i], i=1..9)}:
extend:= proc(p) local x; op(select(t -> t[2]<=N, [seq([10*p[1]+x, 2*p[2]+x], x=0..9)])); end proc:
sorter:= proc(p1, p2) if p1[2] <> p2[2] then p1[2] < p2[2] else p1[1] < p2[1] fi end proc:
while Agenda <> {} do
Agenda:= map(extend, Agenda);
L:= L union Agenda;
od:
L:= sort( convert(L, list), sorter):
map(t -> t[1], L); # Robert Israel, Feb 24 2019
PROG
(PARI) my(A028897(n)=fromdigits(digits(n), 2), S=[]); for(k=1, 2^10, (t=A028897(k))>9||S=setunion(S, [[t, k]])); apply(t->t[2], S)
CROSSREFS
Cf. A028897, A072170 (see comments).
KEYWORD
nonn,base,look
AUTHOR
M. F. Hasler, Feb 13 2019
STATUS
approved
Indices where A028897(A322000(n)) increases. Partial sums of A072170(n,10).
+20
2
0, 1, 2, 4, 6, 10, 14, 20, 26, 36, 46, 59, 72, 90, 108, 130, 152, 182, 212, 248, 284, 329, 374, 426, 478, 542, 606, 678, 750, 834, 918, 1011, 1104, 1214, 1324, 1446, 1568, 1708, 1848, 2002, 2156, 2333, 2510, 2702, 2894, 3108, 3322, 3552, 3782, 4040, 4298, 4575, 4852, 5156, 5460, 5784, 6108, 6464, 6820, 7196, 7572, 7977, 8382
OFFSET
0,3
COMMENTS
A322000 lists all nonnegative integers m ordered by increasing "decibinary" value N = A028897(m) = Sum d[i]*2^i where d[i] are the decimal digits of m. A072170(N,10) says in how many ways a given N can be written in that way. Accordingly, this is also the length of runs of identical values A028897(A322000(k)), and the partial sums, listed here as a(k), give the indices of A322000 where the decibinary value of the terms go up by one.
We have a(k) <= A000123(k-1) with equality for 1 <= k <= 10: the first differences of A000123 give back that sequence with terms duplicated, and this is the limiting column of A072170.
FORMULA
a(n) = Sum_{0 <= k < n} A072170(k,10).
PROG
(PARI) A322003(n)=sum(k=0, n-1, A072170(k, 10))
A322003_vec=vector(99, k, s=if(k>1, s)+A072170(k-1, 10)) \\ more efficient for computing a large vector. Excludes the initial a(0) = 0 to have 1-based indices of the vector match the indices of the components a(n), n >= 1.
CROSSREFS
KEYWORD
nonn
AUTHOR
M. F. Hasler, Feb 19 2019
STATUS
approved
The binary numbers (or binary words, or binary vectors, or binary expansion of n): numbers written in base 2.
(Formerly M4679)
+10
761
0, 1, 10, 11, 100, 101, 110, 111, 1000, 1001, 1010, 1011, 1100, 1101, 1110, 1111, 10000, 10001, 10010, 10011, 10100, 10101, 10110, 10111, 11000, 11001, 11010, 11011, 11100, 11101, 11110, 11111, 100000, 100001, 100010, 100011, 100100, 100101, 100110, 100111
OFFSET
0,3
COMMENTS
List of binary numbers. (This comment is to assist people searching for that particular phrase. - N. J. A. Sloane, Apr 08 2016)
Or, numbers that are sums of distinct powers of 10.
Or, numbers having only digits 0 and 1 in their decimal representation.
Complement of A136399; A064770(a(n)) = a(n). - Reinhard Zumkeller, Dec 30 2007
From Rick L. Shepherd, Jun 25 2009: (Start)
Nonnegative integers with no decimal digit > 1.
Thus nonnegative integers n in base 10 such that kn can be calculated by normal addition (i.e., n + n + ... + n, with k n's (but not necessarily k + k + ... + k, with n k's)) or multiplication without requiring any carry operations for 0 <= k <= 9. (End)
For n > 1: A257773(a(n)) = 10, numbers that are Belgian-k for k=0..9. - Reinhard Zumkeller, May 08 2015
For any integer n>=0, find the binary representation and then interpret as decimal representation giving a(n). - Michael Somos, Nov 15 2015
N is in this sequence iff A007953(N) = A101337(N). A028897 is a left inverse. - M. F. Hasler, Nov 18 2019
For n > 0, numbers whose largest decimal digit is 1. - Stefano Spezia, Nov 15 2023
REFERENCES
Heinz Gumin, "Herrn von Leibniz' 'Rechnung mit Null und Eins'", Siemens AG, 3. Auflage 1979 -- contains facsimiles of Leibniz's papers from 1679 and 1703.
Manfred R. Schroeder, "Fractals, Chaos, Power Laws", W. H. Freeman, 1991, p. 383.
N. J. A. Sloane and Simon Plouffe, The Encyclopedia of Integer Sequences, Academic Press, 1995 (includes this sequence).
FORMULA
a(n) = Sum_{i=0..m} d(i)*10^i, where Sum_{i=0..m} d(i)*2^i is the base 2 representation of n.
a(n) = (1/2)*Sum_{i>=0} (1-(-1)^floor(n/2^i))*10^i. - Benoit Cloitre, Nov 20 2001
a(n) = A097256(n)/9.
a(2n) = 10*a(n), a(2n+1) = a(2n)+1.
G.f.: 1/(1-x) * Sum_{k>=0} 10^k * x^(2^k)/(1+x^(2^k)) - for sequence as decimal integers. - Franklin T. Adams-Watters, Jun 16 2006
a(A000290(n)) = A001737(n). - Reinhard Zumkeller, Apr 25 2009
a(n) = Sum_{k>=0} A030308(n,k)*10^k. - Philippe Deléham, Oct 19 2011
For n > 0: A054055(a(n)) = 1. - Reinhard Zumkeller, Apr 25 2012
a(n) = Sum_{k=0..floor(log_2(n))} floor((Mod(n/2^k, 2)))*(10^k). - José de Jesús Camacho Medina, Jul 24 2014
EXAMPLE
a(6)=110 because (1/2)*((1-(-1)^6)*10^0 + (1-(-1)^3)*10^1 + (1-(-1)^1)*10^2) = 10 + 100.
G.f. = x + 10*x^2 + 11*x^3 + 100*x^4 + 101*x^5 + 110*x^6 + 111*x^7 + 1000*x^8 + ...
.
000 The numbers < 2^n can be regarded as vectors with
001 a fixed length n if padded with zeros on the left
010 side. This represents the n-fold Cartesian product
011 over the set {0, 1}. In the example on the left,
100 n = 3. (See also the second Python program.)
101 Binary vectors in this format can also be seen as a
110 representation of the subsets of a set with n elements.
111 - Peter Luschny, Jan 22 2024
MAPLE
A007088 := n-> convert(n, binary): seq(A007088(n), n=0..50); # R. J. Mathar, Aug 11 2009
MATHEMATICA
Table[ FromDigits[ IntegerDigits[n, 2]], {n, 0, 39}]
Table[Sum[ (Floor[( Mod[f/2 ^n, 2])])*(10^n) , {n, 0, Floor[Log[2, f]]}], {f, 1, 100}] (* José de Jesús Camacho Medina, Jul 24 2014 *)
FromDigits/@Tuples[{1, 0}, 6]//Sort (* Harvey P. Dale, Aug 10 2017 *)
PROG
(PARI) {a(n) = subst( Pol( binary(n)), x, 10)}; /* Michael Somos, Jun 07 2002 */
(PARI) {a(n) = if( n<=0, 0, n%2 + 10*a(n\2))}; /* Michael Somos, Jun 07 2002 */
(PARI) a(n)=fromdigits(binary(n), 10) \\ Charles R Greathouse IV, Apr 08 2015
(Haskell)
a007088 0 = 0
a007088 n = 10 * a007088 n' + m where (n', m) = divMod n 2
-- Reinhard Zumkeller, Jan 10 2012
(Python)
def a(n): return int(bin(n)[2:])
print([a(n) for n in range(40)]) # Michael S. Branicky, Jan 10 2021
(Python)
from itertools import product
n = 4
for p in product([0, 1], repeat=n): print(''.join(str(x) for x in p))
# Peter Luschny, Jan 22 2024
CROSSREFS
The basic sequences concerning the binary expansion of n are this one, A000120 (Hammingweight: sum of bits), A000788 (partial sums of A000120), A000069 (A000120 is odd), A001969 (A000120 is even), A023416 (number of bits 0), A059015 (partial sums). Bisections A099820 and A099821.
Cf. A028897 (convert binary to decimal).
KEYWORD
nonn,base,nice,easy
STATUS
approved
a(0)=1; thereafter a(n+1) = a(n) + number of 1's in binary representation of a(n).
+10
34
1, 2, 3, 5, 7, 10, 12, 14, 17, 19, 22, 25, 28, 31, 36, 38, 41, 44, 47, 52, 55, 60, 64, 65, 67, 70, 73, 76, 79, 84, 87, 92, 96, 98, 101, 105, 109, 114, 118, 123, 129, 131, 134, 137, 140, 143, 148, 151, 156, 160, 162, 165, 169, 173, 178, 182, 187, 193, 196, 199, 204
OFFSET
0,2
COMMENTS
Sequence A230297 (and A157845 without initial term) converted from binary to decimal, cf. formula. - M. F. Hasler, Nov 18 2019
LINKS
Raoul Nakhmanson-Kulish, Graph of a(n)/(n*log_2(n)/2), showing self-similar fractal structure.
Raoul Nakhmanson-Kulish, Graph of f(n), where f(n) = (a(n)-n*log_2(n)/2)/(n*sqrt(log_2(n)*log_2 log_2(n))) (see Stolarsky's estimate below).
Kenneth B. Stolarsky, The sum of a digitaddition series, Proc. Amer. Math. Soc. 59 (1976), no. 1, 1--5. MR0409340 (53 #13099)
FORMULA
a(n) = (n/2)*log n + O(n*sqrt(log n * loglog n)), where log means log_2. In particular, a(n) ~ (n/2)*log n. [Stolarsky]
a(n + 1) = A092391(a(n)) = a(n) + A000120(a(n)). - Reinhard Zumkeller, May 27 2012, May 08 2004; corrected thanks to a notice by Lambert Herrgesell
a(n) = A028897(A230297(n)) = A028897(A157845(n+1)). - M. F. Hasler, Nov 18 2019
EXAMPLE
a(7) = 14 because a(6) = 12, which is 1100 in binary (having 2 on bits), and 12 + 2 = 14.
a(8) = 17 because a(7) = 14, which is 1110 in binary (having 3 on bits), and 14 + 3 = 17.
MATHEMATICA
NestList[# + DigitCount[#, 2, 1] &, 1, 60] (* Alonso del Arte, Oct 26 2012 *)
PROG
(PARI) print1(s=1); for(n=2, 30, print1(", ", s+=hammingweight(s))) \\ Charles R Greathouse IV, Oct 27 2012
(PARI) A010062=List(1); A010062(n)={for(n=#A010062, n, listput(A010062, A092391(A010062[n]))); A010062[n+1]} \\ A092391(n)=n+hammingweight(n). - M. F. Hasler, Nov 18 2019
(Haskell)
a010062 n = a010062_list !! n
a010062_list = iterate a092391 1 -- Reinhard Zumkeller, May 13 2012
(Magma) [n le 1 select 1 else Self(n-1)+&+Intseq(Self(n-1), 2): n in [1..61]]; // Bruno Berselli, Oct 27 2012
(Python)
from itertools import islice
def agen():
an = 1
while True: yield an; an += an.bit_count()
print(list(islice(agen(), 61))) # Michael S. Branicky, Jul 31 2022
CROSSREFS
First row of A228083.
For the base-10 analog see A004207.
Cf. A000120, A010061, A092391, A229167, A096303, A229743, A229744, A230297 (this sequence written in binary), A230298 (read mod 2).
See A230088 for partial sums.
Equals A028897 o A230297 = A028897 o A157845 (up to offset); see also A007088.
KEYWORD
nonn,base,easy,nice
AUTHOR
Leonid Broukhis, Mar 15 1996
EXTENSIONS
More terms from Benoit Cloitre, Jun 02 2002
Stolarsky reference from Matthew C. Russell, Oct 08 2013
STATUS
approved
a(n) = n_n, where "N_b" denotes "N read in base b": if N = Sum c_i 10^i then N_b = Sum c_i b^i.
+10
33
1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 12, 14, 16, 18, 20, 22, 24, 26, 28, 40, 43, 46, 49, 52, 55, 58, 61, 64, 67, 90, 94, 98, 102, 106, 110, 114, 118, 122, 126, 160, 165, 170, 175, 180, 185, 190, 195, 200, 205, 250, 256, 262, 268, 274, 280, 286, 292, 298, 304, 360, 367, 374, 381, 388
OFFSET
1,2
COMMENTS
The definition applies even if b < 10. Examples: 23_45 = 2*45 + 3 = 93, 23_2 = 2*2 + 3 = 7.
REFERENCES
David Applegate, Marc LeBrun and N. J. A. Sloane, Descending Dungeons and Iterated Base-Changing, in "The Mathematics of Preference, Choice and Order: Essays in Honor of Peter Fishburn", edited by Steven Brams, William V. Gehrlein and Fred S. Roberts, Springer, 2009, pp. 393-402.
LINKS
David Applegate, Marc LeBrun and N. J. A. Sloane, Descending Dungeons and Iterated Base-Changing, arXiv:math/0611293 [math.NT], 2006-2007.
David Applegate, Marc LeBrun, N. J. A. Sloane, Descending Dungeons, Problem 11286, Amer. Math. Monthly, 116 (2009) 466-467.
MAPLE
A122618 := proc(n)
local dgs;
dgs := convert(n, base, 10) ;
add(op(i, dgs)*n^(i-1), i=1..nops(dgs)) ;
end proc: # R. J. Mathar, May 06 2019
MATHEMATICA
f[n_] := FromDigits[ IntegerDigits@n, n]; Array[f, 64] (* Robert G. Wilson v, Sep 27 2006 *)
PROG
(PARI) A122618(n, d=digits(n))=d*vectorv(#d, i, n^(#d-i)) \\ M. F. Hasler, Apr 22 2015
CROSSREFS
Differs from A083292 starting at n=100.
Cf. A028897 (n_2), A122640 (2n_2).
KEYWORD
nonn,base,easy
AUTHOR
N. J. A. Sloane, Sep 21 2006
STATUS
approved
If n = Sum c_i * 10^i then a(n) = Sum c_i * Cat(i+1), where Cat(k) = A000108(k).
+10
10
0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 5
OFFSET
0,3
COMMENTS
This sequence converts any number from various "Catalan Base number systems" (when represented as decimal numbers) back to the integer the numeral represents: e.g. we have a(A014418(n)) = n and a(A244159(n)) = n (except for the latter this is eventually broken by the shortcomings of the decimal representation used, while for the former it works for all n, because no digits larger than 3 will ever appear in the terms of A014418).
A197433 is similar, but replaces 2^k with A000108(k+1) in binary expansion of n.
For 1- and 2-digit numbers the same as A156230. - R. J. Mathar, Jun 27 2014
MAPLE
A244158 := proc(n)
local dgs, k ;
dgs := convert(n, base, 10) ;
add( op(k, dgs)*A000108(k), k=1..nops(dgs)) ;
end proc: # R. J. Mathar, Jan 31 2015
PROG
(MIT/GNU Scheme) (define (A244158 n) (let loop ((z 0) (i 1) (n n)) (if (zero? n) z (loop (+ z (* (modulo n 10) (A000108 i))) (1+ i) (floor->exact (/ n 10))))))
CROSSREFS
Differs from A028897 and A081594 for the first time at n=100, which here is a(100) = 5.
KEYWORD
nonn,base,less
AUTHOR
Antti Karttunen, Jun 22 2014
STATUS
approved
Let n = 10x + y where 0 <= y <= 9, x >= 0. Then a(n) = 2x+y.
+10
8
0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 20
OFFSET
0,3
LINKS
Index entries for linear recurrences with constant coefficients, signature (1, 0, 0, 0, 0, 0, 0, 0, 0, 1, -1).
FORMULA
a(n) = (2 * floor(n/10)) + (n modulo 10). - Antti Karttunen, Jun 22 2014
G.f.: -x*(7*x^9 -x^8 -x^7 -x^6 -x^5 -x^4 -x^3 -x^2 -x -1) / ((x -1)^2*(x +1)*(x^4 -x^3 +x^2 -x +1)*(x^4 +x^3 +x^2 +x +1)). - Colin Barker, Jun 23 2014
a(n) = n - 8*floor(n/10). [Bruno Berselli, Jun 24 2014]
MAPLE
A081594:=n->n-8*floor(n/10); seq(A081594(n), n=0..100); # Wesley Ivan Hurt, Jun 25 2014
MATHEMATICA
CoefficientList[Series[-x (7 x^9 - x^8 - x^7 - x^6 - x^5 - x^4 - x^3 - x^2 - x - 1)/((x - 1)^2 (x + 1) (x^4 - x^3 + x^2 - x+1) (x^4 + x^3 + x^2 + x + 1)), {x, 0, 150}], x] (* Vincenzo Librandi, Jun 25 2014 *)
LinearRecurrence[{1, 0, 0, 0, 0, 0, 0, 0, 0, 1, -1}, {0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 2}, 110] (* or *) Table[Range[n, n+9], {n, 0, 26, 2}]//Flatten (* Harvey P. Dale, Jul 22 2021 *)
PROG
(MIT/GNU Scheme) (define (A081594 n) (+ (* 2 (floor->exact (/ n 10))) (modulo n 10))) ;; Antti Karttunen, Jun 22 2014
(PARI) my(n, x, y); vector(200, n, y=(n-1)%10; x=(n-1-y)\10; 2*x+y) \\ Colin Barker, Jun 24 2014
(Magma) [(n+4*y)/5 where y is n mod 10: n in [0..100]]; // Bruno Berselli, Jun 24 2014
(Sage) [n-8*floor(n/10) for n in (0..100)] # Bruno Berselli, Jun 24 2014
CROSSREFS
Cf. A081502. Differs from A028897, A156230 and A244158 for the first time at n=100, which here is a(100) = 20.
KEYWORD
nonn,easy
AUTHOR
N. J. A. Sloane, Apr 22 2003
EXTENSIONS
Terms up to n=100 added by Antti Karttunen, Jun 22 2014
G.f. revised by Vincenzo Librandi, Jun 25 2014
STATUS
approved
a(n) = A010062(n) written in binary: a(n+1) = a(n) + hammingweight(a(n)) in binary.
+10
4
1, 10, 11, 101, 111, 1010, 1100, 1110, 10001, 10011, 10110, 11001, 11100, 11111, 100100, 100110, 101001, 101100, 101111, 110100, 110111, 111100, 1000000, 1000001, 1000011, 1000110, 1001001, 1001100, 1001111, 1010100, 1010111, 1011100, 1100000, 1100010, 1100101, 1101001, 1101101, 1110010, 1110110, 1111011, 10000001, 10000011
OFFSET
0,2
COMMENTS
Is there any way to tell by looking at a binary number whether or not it is a term of this sequence?
FORMULA
a(n) = A157845(n+1) = A007088(A010062(n)) = A007088(A092391(A028897(a(n-1)))). - M. F. Hasler, Nov 18 2019
MATHEMATICA
s[0] = 1; s[n_] := s[n] = s[n-1] + DigitCount[s[n-1], 2, 1]; Table[FromDigits[IntegerDigits[s[n], 2]], {n, 0, 50}] (* Amiram Eldar, Jul 28 2023 *)
PROG
(PARI) (A230297(n)=A007088(A010062(n))); A230297_vec(N)={vector(N, i, if(i>1, A007088(N+=hammingweight(N)), N=1))} \\ M. F. Hasler, Nov 18 2019
CROSSREFS
Cf. A010062.
Essentially the same as A157845.
Cf. A004207 (base-10 analog); A007088 (n in binary), A010062 (this written in base 10), A000120 (Hammingweight), A092391 (A000120(n) + n), A028897 (convert binary to decimal).
KEYWORD
nonn,base
AUTHOR
N. J. A. Sloane, Oct 17 2013
STATUS
approved
a(0) = 1, a(n) = sum of binary digits of all prior terms, expressed in binary.
+10
3
1, 1, 10, 11, 101, 111, 1010, 1100, 1110, 10001, 10011, 10110, 11001, 11100, 11111, 100100, 100110, 101001, 101100, 101111, 110100, 110111, 111100, 1000000, 1000001, 1000011, 1000110, 1001001, 1001100, 1001111, 1010100, 1010111, 1011100, 1100000, 1100010
OFFSET
0,3
COMMENTS
Equals A230297 = A010062 converted from decimal to binary, prefixed by another initial 1. - M. F. Hasler, Nov 18 2019
LINKS
FORMULA
a(n) = A230297(n-1) = A007088(A010062(n-1)) = A007088(A092391(A028897(a(n-1)))) for n > 0. - M. F. Hasler, Nov 18 2019
MAPLE
b:= proc(n) option remember; `if`(n<2, 1, b(n-1)+
add(i, i=convert(a(n-1), base, 10)))
end:
a:= n-> convert(b(n), binary):
seq(a(n), n=0..44); # Alois P. Heinz, Nov 18 2019
MATHEMATICA
s[0] = s[1] = 1; s[n_] := s[n] = s[n-1] + DigitCount[s[n-1], 2, 1]; Table[FromDigits[IntegerDigits[s[n], 2]], {n, 0, 50}] (* Amiram Eldar, Jul 28 2023 *)
PROG
(PARI) lista(nn) = {my(s = 1); my(t = 1); print1(t, ", "); for (i=1, nn, sb = binary(s); t = subst(Pol(sb), x, 10); print1(t, ", "); s += hammingweight(sb); ); }
(PARI) apply( A157845(n)=fromdigits(binary(A010062(n-!!n))), [0..40]) \\ M. F. Hasler, Nov 18 2019
CROSSREFS
Cf. A004207 (base-10 analog); A007088 (n in binary), A010062 (this written in base 10), A000120 (Hammingweight), A092391 (A000120(n) + n), A028897 (convert binary to decimal).
KEYWORD
base,easy,nonn
AUTHOR
Oliver K. Seet, Mar 07 2009
EXTENSIONS
a(11) corrected and extended by R. J. Mathar, Mar 12 2009
More terms from Michel Marcus, Apr 19 2014
STATUS
approved
Numbers whose binary representation is palindromic and in which all runs of 0's and 1's have length at least 2.
+10
3
3, 7, 15, 31, 51, 63, 99, 127, 195, 231, 255, 387, 455, 511, 771, 819, 903, 975, 1023, 1539, 1651, 1799, 1935, 2047, 3075, 3171, 3315, 3591, 3687, 3855, 3999, 4095, 6147, 6371, 6643, 7175, 7399, 7695, 7967, 8191, 12291, 12483, 12771, 13107, 13299, 14343, 14535, 14823, 15375, 15567, 15903, 16191, 16383, 24579
OFFSET
1,1
COMMENTS
These are the decimal representations of A061851 read as base-2 numbers.
The terms with an odd number L = 2k-1 of bits, i.e., 2^(L-1) < a(n) < 2^L, are given by the terms of A033015 with length k, shifted k-1 digits to the left and 'OR'ed with the binary reversal of the term. Terms with an even number L = 2k of digits are given as m*2^k + (binary reversal of m) where m runs over the k-bit terms from A033015 and the k-1 bit terms with the last bit negated appended). This explains the FORMULA for the number of terms of given size. - M. F. Hasler, Oct 17 2022
LINKS
Ray Chandler, Table of n, a(n) for n = 1..10000 (first 608 terms from N. J. A. Sloane)
FORMULA
From M. F. Hasler, Oct 06 2022: (Start)
Intersection of A006995 and A033015: binary palindromes with no isolated digit.
There are A000045(A004526(k)) = Fibonacci(floor(k/2)) terms between 2^(k-1) and 2^k.
a(n) = A028897(A061851(n)), where A028897 = convert binary to decimal. (End)
EXAMPLE
51 (base 10) = 110011 (base 2), which is a palindrome and has three runs all of length 2.
MATHEMATICA
brpalQ[n_]:=Module[{idn2=IntegerDigits[n, 2]}, idn2==Reverse[idn2] && Min[ Length/@ Split[idn2]]>1]; Select[Range[25000], brpalQ] (* Harvey P. Dale, May 21 2014 *)
PROG
(PARI) is(n)=is_A033015(n)&&Vecrev(n=binary(n))==n \\ M. F. Hasler, Oct 06 2022
(PARI) {A222813_row(n, s=A033015_row(n\/2))=apply(A030101, if(n%2, s\2, n>2, s=setunion([k*2+1-k%2|k<-A033015_row(n\2-1)], s), s=[1]))+s<<(n\2)} \\ Terms with n bits, i.e. between 2^(n-1) and 2^n. - M. F. Hasler, Oct 17 2022
CROSSREFS
Cf. A061851.
Cf. A006995 (binary palindromes), A033015 (no isolated binary digit), A028897 ("rebase" 10 -> 2).
KEYWORD
nonn,base
AUTHOR
N. J. A. Sloane, Mar 11 2013
STATUS
approved

Search completed in 0.013 seconds