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.

Showing 1-2 of 2 results.

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

A266578 Least number N such that the product n*N has the same digits as the concatenation (n,N) (counting repetitions), or 0 if no such number exists.

Original entry on oeis.org

0, 8714, 51, 0, 251, 21, 0, 86, 351, 0, 9209, 86073, 0, 926, 93, 0, 9635, 6012, 0, 8714, 6, 0, 9017, 651, 0, 401, 81, 0, 3701, 51, 0, 926, 40611, 0, 41, 936, 0, 3251, 6882, 0, 35, 678, 0, 9203, 3141, 0, 371, 2913, 0, 251, 3, 0, 635, 846, 0, 2171, 834, 0, 845, 21, 0, 1814, 585, 0, 281, 9843
Offset: 1

Views

Author

David W. Wilson and M. F. Hasler, Jan 01 2016

Keywords

Comments

See A266586 for the variant where repeated digits are not counted.
One has a(3k-1) = 3*b(k)-1 with b = (2905, 84, 29, 3070, 309, 3212, 2905, ...), and a(3k) = 3*c(k) with c = (17, 7, 117, 28691, 31, 2004, ...).
If n = 1 (mod 3), then the sum of digits of n*N = N (mod 3) is always different from the sum of digits of concat(n,N) which is 1+N (mod 3), therefore a(3k+1) = 0 for all k.

Examples

			For n = 1 there cannot be a number N such that n*N (= N) has the same digits as concat(n,N) (= "1N"), therefore a(1)=0.
For n = 2 and N = 8714 we have n*N = 17428 which has the same digits (1,2,4,7,8) as concat(n,N) = 28714. This N is the smallest such number, therefore a(2) = 8714.
Since 3*51 = 153 has the same digits than concat(3,51), and 51 is the smallest such number, a(3) = 153.
For n = 4 there is again no N with the desired property, thus a(4) = 0.
Since 5*251 = 1255 has the same digits (with repetition) than "5" and "251" together, a(5) = 1255.
		

Programs

  • Mathematica
    Table[If[Mod[n, 3] == 1, 0, k = 1; While[Sort@ IntegerDigits[n k] != Sort@ Join[IntegerDigits@ n, IntegerDigits@ k], k++]; k], {n, 66}]
  • PARI
    a(n,L=if(n%3!=1,9e9),d=digits(n))=for(k=2,L,vecsort(digits(k*n))==vecsort(concat(d,digits(k)))&&return(k))
    
  • Python
    from itertools import count
    from collections import Counter as Ctr
    def a(n):
        r = n%3
        if r == 1: return 0
        s = str(n)
        return next(N for N in count(r, 3) if Ctr(str(n*N)) == Ctr(s+str(N)))
    print([a(n) for n in range(1, 67)]) # Michael S. Branicky, Nov 15 2022

Formula

a(3k+1) = 0 for all k >= 0; a(3k+2) = 2 (mod 3) for all k >= 0; a(3k) = 0 (mod 3) for all k >= 1.
Showing 1-2 of 2 results.