OFFSET
1,2
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.
LINKS
David W. Wilson, Table of n, a(n) for n = 1..10000
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.
EXAMPLE
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.
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}]
PROG
(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
CROSSREFS
KEYWORD
nonn,base
AUTHOR
David W. Wilson and M. F. Hasler, Jan 01 2016
STATUS
approved