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.

A342076 Digits only come in successive pairs (separated or not by a comma).

This page as a plain text file.
%I A342076 #8 Feb 28 2021 10:09:49
%S A342076 1,11,12,2,3,31,13,32,21,14,4,5,51,15,52,22,23,33,34,41,16,6,7,71,17,
%T A342076 72,24,42,25,53,35,54,43,36,61,18,8,9,91,19,92,26,62,27,73,37,74,44,
%U A342076 45,55,56,63,38,81,100,66,77,88,99,111,122,112,28,82,29,93,39,94,46,64,47,75,57,76,65,58,83,300
%N A342076 Digits only come in successive pairs (separated or not by a comma).
%C A342076 The sequence starts with a(1) = 1 and is always extended with the smallest positive integer not yet present that does not lead to a contradiction.
%C A342076 No term can end with an odd number of successive 0.
%C A342076 This is not the sequence A329127 as they diverge at a(55).
%e A342076 a(1) = 1 forces the next digit to be a 1 (as digits must come in pairs); the smallest positive integer not yet present that starts with a 1 and does not lead to a contradiction is 11 (as 10, ending with an odd number of 0, is forbidden). Thus, a(2) = 11;
%e A342076 a(3) = 12 as a(3) must start with a 1 (to complete a pair of identical digits), and 12 is the smallest positive integer not yet present that does not lead to a contradiction;
%e A342076 a(4) = 2 as 2 is the smallest positive integer not yet present that starts with a 2 and does not lead to a contradiction; etc.
%o A342076 (Python)
%o A342076 mustpair = set(range(10))
%o A342076 def pairsup(n, offset=0):
%o A342076   digits = list(map(int, str(n)))[offset:]
%o A342076   if len(digits) == 0: return True, False
%o A342076   i = 0
%o A342076   while i < len(digits) - 1:
%o A342076     if digits[i] in mustpair:
%o A342076       if digits[i] != digits[i+1]: return False, None
%o A342076       else: i += 2
%o A342076     else: i += 1
%o A342076   unpaired = digits[-1] in mustpair and i != len(digits)
%o A342076   return not (unpaired and digits[-1] == 0), unpaired
%o A342076 def aupton(terms, startswith=1):
%o A342076   alst, unpaired = [startswith], startswith in mustpair
%o A342076   for n in range(2, terms+1):
%o A342076     m = 1
%o A342076     while True:
%o A342076       while m in alst: m += 1
%o A342076       if not unpaired or int(str(m)[0]) == alst[-1]%10:
%o A342076         passes, temp = pairsup(m, offset=int(unpaired))
%o A342076         if passes: alst.append(m); unpaired = temp; break
%o A342076       m += 1
%o A342076   return alst
%o A342076 print(aupton(66)) # _Michael S. Branicky_, Feb 28 2021
%Y A342076 Cf. A342077, A342078 and A342079 (variations on the same idea), A329127 (first 54 terms are the same).
%K A342076 base,nonn
%O A342076 1,2
%A A342076 _Eric Angelini_, Feb 28 2021