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.

A258227 Concatenate the natural numbers, then partition into minimal strings so that adjacent terms have a common divisor greater than 1.

This page as a plain text file.
%I A258227 #17 Dec 04 2021 12:34:07
%S A258227 12,3,45,6,78,9,1011,12,1314,15,1617,18,192,0,2,12,2,2,32,4,2,52,6,2,
%T A258227 72,8,2,930,3,132,3,3,3,435,3,6,3,738,3,9,4041,42,4,34,4,4,54,6,4,74,
%U A258227 8,4,950,5,15,25,35,45,5,5,65,75,85,960,6,16,2,6,3,6
%N A258227 Concatenate the natural numbers, then partition into minimal strings so that adjacent terms have a common divisor greater than 1.
%C A258227 00 -> 0 is not allowed, else all digits will not appear in the concatenation of terms.  For example, a(198)..a(201) = 198, 19920, 0, 2 and not 198, 192, 0, 2. - _Michael S. Branicky_, Dec 03 2021
%H A258227 Michael S. Branicky, <a href="/A258227/b258227.txt">Table of n, a(n) for n = 1..10000</a> (24 terms corrected in terms 1..10000 from Reinhard Zumkeller)
%F A258227 GCD(a(n), a(n+1)) > 1.
%e A258227 .  a(n) | 12,3,45,6,78,9,1011,12,1314,15,1617,18,192,0,2,12,2,2,32,4,2,52
%e A258227 --------+----------------------------------------------------------------
%e A258227 .  gcd  |   3 3  3 6  3 3    3  6    3  3    3  6 192 2 2  2 2 2  4 2 2  .
%o A258227 (Haskell)
%o A258227 a258227 n = a258227_list !! (n-1)
%o A258227 a258227_list = f 12 1 (map toInteger $ tail a007376_list) where
%o A258227    f x y (d:ds) | gcd x y > 1 = y : f y d ds
%o A258227                 | otherwise   = f x (10 * y + d) ds
%o A258227 (Python)
%o A258227 from math import gcd
%o A258227 from itertools import count
%o A258227 def diggen():
%o A258227     for k in count(1): yield from list(map(int, str(k)))
%o A258227 def aupton(terms):
%o A258227     g = diggen()
%o A258227     alst, aset = [12], {12}
%o A258227     _, _, nxtd, nxtnxtd = next(g), next(g), next(g), next(g)
%o A258227     for n in range(2, terms+1):
%o A258227         an, nxtd, nxtnxtd = nxtd, nxtnxtd, next(g)
%o A258227         while gcd(an, alst[-1]) == 1 or nxtd == nxtnxtd == 0:
%o A258227             an, nxtd, nxtnxtd = int(str(an) + str(nxtd)), nxtnxtd, next(g)
%o A258227         alst.append(an); aset.add(an)
%o A258227     return alst
%o A258227 print(aupton(70)) # _Michael S. Branicky_, Dec 03 2021
%Y A258227 Cf. A002782, A007376.
%K A258227 nonn,base
%O A258227 1,1
%A A258227 _Reinhard Zumkeller_, May 23 2015