login
The OEIS Foundation is supported by donations from users of the OEIS and by a grant from the Simons Foundation.

 

Logo


Hints
(Greetings from The On-Line Encyclopedia of Integer Sequences!)
A322919 Numbers n such that n and n-1 both first appear in the same power of 2 (in base 10). 1
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 (list; graph; refs; listen; history; text; internal format)
OFFSET

1,1

LINKS

David A. Corneth, Table of n, a(n) for n = 1..3106

EXAMPLE

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.

PROG

(C)

#include <stdio.h>

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; j<n; j++) {

    a[j] = v[n] = 0;

    f[j] = g[j] = -1;

  }

  a[0] = 1;

  for (m=0; (m<n) && u; m++) {

    for (j=0; j<n; j++) if (a[j]) b = j;

    for (k=0; k<n; k++) {

      k2 = k;

      for (j=0; k2; j++) {

        d[j] = k2 % r;

        k2 /= r;

      }

      lk = j;

      if (!j) {

        d[0] = 0;

        lk = 1;

      }

      ok2 = 0;

      if ((f[k] == -1) && (lk<=b+1)) {

        ok2 = 0;

        for (l=b-lk+1; l>-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<b+2; j++) {

      a[j] = a[j]*p + c;

      c = 0;

      if (a[j] > r-1) {

        c = a[j] / r;

        a[j] %= r;

      }

    }

  }

  for (i=1; i<n; i++) if (f[i] == f[i-1]) printf("%d\n", i);

  return(0);

}

(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

CROSSREFS

Entries in A030000 that have the same value as the immediately previous entry.

Sequence in context: A033235 A106913 A212266 * A026050 A304356 A283146

Adjacent sequences:  A322916 A322917 A322918 * A322920 A322921 A322922

KEYWORD

nonn,base

AUTHOR

Keith F. Lynch, Dec 30 2018

STATUS

approved

Lookup | Welcome | Wiki | Register | Music | Plot 2 | Demos | Index | Browse | More | WebCam
Contribute new seq. or comment | Format | Style Sheet | Transforms | Superseeker | Recent
The OEIS Community | Maintained by The OEIS Foundation Inc.

License Agreements, Terms of Use, Privacy Policy. .

Last modified April 7 04:20 EDT 2020. Contains 333292 sequences. (Running on oeis4.)