login

Year-end appeal: Please make a donation to the OEIS Foundation to support ongoing development and maintenance of the OEIS. We are now in our 61st year, we have over 378,000 sequences, and we’ve reached 11,000 citations (which often say “discovered thanks to the OEIS”).

A247243
a(n) = smallest positive integer k not already in the sequence such that the decimal expansion of 2^(n-1) begins with k.
2
1, 2, 4, 8, 16, 3, 6, 12, 25, 5, 10, 20, 40, 81, 163, 32, 65, 13, 26, 52, 104, 209, 41, 83, 167, 33, 67, 134, 268, 53, 107, 21, 42, 85, 17, 34, 68, 137, 27, 54, 109, 219, 43, 87, 175, 35, 7, 14, 28, 56, 11, 22, 45, 9, 18, 36, 72, 144, 288, 57, 115, 23, 46, 92
OFFSET
1,2
COMMENTS
Is this a permutation of the positive integers?
EXAMPLE
+----+---------+------+
+ n | 2^(n-1) | a(n) |
+----+---------+------+
| 1 | 1 | 1 |
| 2 | 2 | 2 |
| 3 | 4 | 4 |
| 4 | 8 | 8 |
| 5 | 16 | 16 |
| 6 | 32 | 3 |
| 7 | 64 | 6 |
| 8 | 128 | 12 |
| 9 | 256 | 25 |
| 10 | 512 | 5 |
| 11 | 1024 | 10 |
+----+---------+------+
PROG
(Perl) See Link section.
(Python)
from itertools import count, islice
def ispal(n): s = str(n); return s == s[::-1]
def agen(): # generator of terms
aset, mink = set(), 1
for n in count(1):
k, target = mink, str(2**(n-1))
while k in aset or not target.startswith(str(k)): k += 1
an = k; aset.add(an); yield an
while mink in aset: mink += 1
print(list(islice(agen(), 65))) # Michael S. Branicky, Nov 07 2022
CROSSREFS
Cf. A008952.
Sequence in context: A101943 A378106 A331440 * A341819 A352387 A110001
KEYWORD
nonn,base
AUTHOR
Paul Tek, Nov 30 2014
STATUS
approved