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.
%I A322919 #34 Aug 15 2021 15:35:01 %S A322919 59,74,111,785,793,914,957,985,1070,1467,2019,2099,2332,2610,2934, %T A322919 3028,3083,3311,3334,3973,4198,4208,4334,4590,4689,4785,5247,5350, %U A322919 5535,6166,6335,6669,6761,7167,7340,7707,7980,8668,8990,9180,9840,11110,13096,16285,17418,18091,18361,19219,20522,21494,21827 %N A322919 Numbers k such that k and k-1 both first appear in the same power of 2 (in base 10). %H A322919 David A. Corneth, <a href="/A322919/b322919.txt">Table of n, a(n) for n = 1..3106</a> %e A322919 For instance 2019 is in the sequence since 2018 and 2019 both appear in 2^212 and neither appear in any smaller power of two. %o A322919 (C) %o A322919 #include <stdio.h> %o A322919 int main() { %o A322919 int n = 1000001; /* Highest term */ %o A322919 int p = 2; /* Powers of two. Test throughly if you change it. */ %o A322919 int r = 10; /* Base ten. Test throughly if you change it. */ %o A322919 char a[n]; %o A322919 int b,c,i,j,k,k2,l,lk,m,ok,ok2,u,d[7],f[n],g[n],v[n]; %o A322919 u = n; %o A322919 for (j=0;j<n;j++) { %o A322919 a[j] = v[j] = 0; /* corrected v[n] to v[j]. - _M. F. Hasler_, Jul 05 2021*/ %o A322919 f[j] = g[j] = -1; %o A322919 } %o A322919 a[0] = 1; %o A322919 for (m=0;(m<n) && u;m++) { %o A322919 for (j=0;j<n;j++) if (a[j]) b = j; %o A322919 for (k=0;k<n;k++) { %o A322919 k2 = k; %o A322919 for (j=0;k2;j++) { %o A322919 d[j] = k2 % r; %o A322919 k2 /= r; %o A322919 } %o A322919 lk = j; %o A322919 if (!j) { %o A322919 d[0] = 0; %o A322919 lk = 1; %o A322919 } %o A322919 ok2 = 0; %o A322919 if ((f[k] == -1) && (lk<=b+1)) { %o A322919 ok2 = 0; %o A322919 for (l=b-lk+1;l>-1;l--) { %o A322919 ok = 1; %o A322919 for (j=lk-1;j>-1;j--) if (a[l+j] != d[j]) ok = 0; %o A322919 if (ok) ok2 = 1; %o A322919 } %o A322919 if (ok2) { %o A322919 f[k] = m; %o A322919 u--; %o A322919 } %o A322919 } %o A322919 if ((g[k]==-1) && (lk<=b+1)) { %o A322919 ok = 1; %o A322919 for (j=lk-1;j>-1;j--) if (a[b-lk+j+1] != d[j]) ok = 0; %o A322919 if (ok) g[k] = m; %o A322919 } %o A322919 } %o A322919 c = 0; %o A322919 for (j=0;j<b+2;j++) { %o A322919 a[j] = a[j]*p + c; %o A322919 c = 0; %o A322919 if (a[j] > r-1) { %o A322919 c = a[j] / r; %o A322919 a[j] %= r; %o A322919 } %o A322919 } %o A322919 } %o A322919 for (i=1;i<n;i++) if (f[i] == f[i-1]) printf("%d\n",i); %o A322919 return(0); %o A322919 } %o A322919 (PARI) uptoQdigits(n) = {v = vector(10^n); p = 1/2; todo = 10^n; my(res = List()); %o A322919 for(i = 1, oo, p<<=1; process(p, n); if(todo <= 0, break)); for(i = 1, #v - 1, %o A322919 if(v[i] == v[i+1], listput(res, i))); res} %o A322919 process(p, n) = {my(dp = digits(p), vd, lp = logint(p, 2)); qdp = #dp; my(t = min(n, qdp)); for(qd = 1, t, for(j = 1, qdp - qd + 1, vd = fromdigits(vector(qd, i, dp[j+i-1])); if(v[vd + 1] == 0, v[vd + 1] = lp; todo--)))} \\ _David A. Corneth_, Dec 31 2018 %Y A322919 Indices of consecutive repeats in A030000. %K A322919 nonn,base %O A322919 1,1 %A A322919 _Keith F. Lynch_, Dec 30 2018