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.

A322919 Numbers k such that k and k-1 both first appear in the same power of 2 (in base 10).

Original entry on oeis.org

59, 74, 111, 785, 793, 914, 957, 985, 1070, 1467, 2019, 2099, 2332, 2610, 2934, 3028, 3083, 3311, 3334, 3973, 4198, 4208, 4334, 4590, 4689, 4785, 5247, 5350, 5535, 6166, 6335, 6669, 6761, 7167, 7340, 7707, 7980, 8668, 8990, 9180, 9840, 11110, 13096, 16285, 17418, 18091, 18361, 19219, 20522, 21494, 21827
Offset: 1

Views

Author

Keith F. Lynch, Dec 30 2018

Keywords

Examples

			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.
		

Crossrefs

Indices of consecutive repeats in A030000.

Programs

  • C
    #include 
    int main() {
      int n = 1000001;  /* Highest term */
      int p = 2;        /* Powers of two.  Test throughly if you change it. */
      int r = 10;       /* Base ten.  Test throughly if you change it. */
      char a[n];
      int b,c,i,j,k,k2,l,lk,m,ok,ok2,u,d[7],f[n],g[n],v[n];
      u = n;
      for (j=0;jM. F. Hasler, Jul 05 2021*/
        f[j] = g[j] = -1;
      }
      a[0] = 1;
      for (m=0;(m-1;l--) {
              ok = 1;
              for (j=lk-1;j>-1;j--) if (a[l+j] != d[j]) ok = 0;
              if (ok) ok2 = 1;
            }
            if (ok2) {
              f[k] = m;
              u--;
            }
          }
          if ((g[k]==-1) && (lk<=b+1)) {
            ok = 1;
            for (j=lk-1;j>-1;j--) if (a[b-lk+j+1] != d[j]) ok = 0;
            if (ok) g[k] = m;
          }
        }
        c = 0;
        for (j=0;j r-1) {
            c = a[j] / r;
            a[j] %= r;
          }
        }
      }
      for (i=1;i
    				
  • PARI
    uptoQdigits(n) = {v = vector(10^n); p = 1/2; todo = 10^n; my(res = List());
    for(i = 1, oo, p<<=1; process(p, n); if(todo <= 0, break)); for(i = 1, #v - 1,
    if(v[i] == v[i+1], listput(res, i))); res}
    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