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.

A266798 Least positive integer N such that n+N has the same digits as n and N together (without counting repetitions).

Original entry on oeis.org

10, 100, 100, 100, 100, 100, 100, 100, 100, 89, 99, 1000, 1000, 818, 1000, 1000, 1000, 1000, 168, 90, 100, 1000, 1000, 1000, 1000, 727, 336, 247, 1000, 899, 100, 1000, 1000, 1000, 1000, 1000, 326, 636, 1000, 899, 100, 1000, 1000, 1000, 1000, 405, 1000, 227, 1000, 545, 100, 1000, 1000, 1000, 450, 494, 1000, 1000, 1000, 899
Offset: 0

Views

Author

M. F. Hasler, Jan 01 2016

Keywords

Comments

Such an N always exists since 10^(1 + number of digits of n) satisfies the property.
a(n) = 1 for almost all n (in the sense of natural density). - Charles R Greathouse IV, Nov 15 2022
What is the largest number in this sequence? It is somewhere between a(9911111111) = 302345678 and 203456789111111111. - Charles R Greathouse IV, Dec 09 2022

Crossrefs

Programs

  • Maple
    digs:= proc(n) option remember;
      local t;
      t:= n mod 10;
      if n < 10 then {t}
      else {t} union procname((n-t)/10)
      fi;
    end proc:
    f:= proc(n)
      local k,Ln;
      Ln:= digs(n);
      for k from 1 do
         if Ln union digs(k) = digs(n+k) then return k fi
      od
    end proc:
    seq(f(n),n=0..100); # Robert Israel, Jan 03 2016
  • PARI
    a(n,d=digits(n),L=10^(1+#d))=for(k=1,L,Set(digits(k+n))==Set(concat(d,digits(k)))&&return(k))
    
  • Python
    from itertools import count
    def a(n):
        digs = set(str(n))
        return next(N for N in count(1) if digs | set(str(N)) == set(str(n+N)))
    print([a(n) for n in range(60)]) # Michael S. Branicky, Nov 15 2022

Formula

a(n) <= 10^(1 + number of digits of n).
a(n) <= 203456789111111111 < 2.04 * 10^17. (This can probably be improved by a few orders of magnitude.) - Charles R Greathouse IV, Nov 15 2022