login
Composite m-digit numbers with m <> 3k and digital product = 7 that are divisible by 7.
1

%I #38 Aug 06 2021 06:13:04

%S 11711,1111117,7111111,11171111,1111711111,11111111711,11711111111,

%T 1111111111117,1111117111111,7111111111111,11111111171111,

%U 11171111111111,1111111111711111,1111711111111111,11111111111111711,11111111711111111,11711111111111111,1111111111111111117,1111111111117111111

%N Composite m-digit numbers with m <> 3k and digital product = 7 that are divisible by 7.

%C Proposition: when m > 4 and m <> 3k, there is always at least one m-digit number that is divisible by 7 (proof in Derek Holton in reference), these composites are in this sequence (see A346274).

%C Every term has m = 5+6r, resp. (7+6r, 8+6r, 10+6r (r>=0)) digits and comes from the concatenation of a(1) = 11711, resp. (7, a(4) = 11171111, a(5) = 1111711111) with one or more strings of R_6 = 111111 = 7*15873 placed before and/or after a(1), resp. (7, a(4), a(5)).

%C The corresponding smallest term b(m) with m = 5+6r, resp. (7+6r, 8+6r, 10+6r (r>=0)) digits is b(m) = R_m + 6*10^k with k = 2, resp. (0, 4, 5) with R_m = A002275(m) is the repunit with a string of m 1's.

%C Alternatively, numbers viewed as strings over {1, 7} divisible by 7 are accepted by an automaton with 12 states, {0..6, 0'..6'} - {3, 3'}, with k (resp. k') representing remainder mod 7 where 7 has not (resp. has) been seen; transition function delta(k, 1) = 10*k+1 mod 7, delta(k, 7) = (10*k+7 mod 7)', delta(k', 1) = 10*k'+1 mod 7; start state 0; and accept state 0'. Accepted strings satisfy the regular expression (111111)*(7 + 11711 + 11171111 + 1111711111 + 111117111)(111111)*. This sequence includes all terms matching (111111)*(7 + 11711 + 11171111 + 1111711111)(111111)* except the number 7 alone. - _Michael S. Branicky_, Jul 22 2021

%D Derek Holton, A Second Step to Mathematical Olympiad Problems, Vol. 7, Mathematical Olympiad Series, World Scientific, 2011, Section 8.2. USS 1 p. 260 and Section 8.14 Solutions pp. 284-287.

%e a(1) = 11711 because 11711 has 5 digits, a digital product = 7 and 11711 = 7^2 * 239.

%t seq[digmax_] := Module[{dig = Select[Range[5, digmax], Mod[#, 3] > 0 &], s = {}}, Do[s = Join[s, Select[(10^d - 1)/9 + 6*10^Range[0, d - 1], Divisible[#, 7] &]], {d, dig}]; s]; seq[19] (* _Amiram Eldar_, Jul 22 2021 *)

%o (Python)

%o from sympy import isprime

%o def auptod(digs):

%o return [t for t in (int('1'*(m-1-i) + '7' + '1'*i) for m in range(5, digs+1) if m%3 != 0 for i in range(m)) if t%7 == 0]

%o print(auptod(19)) # _Michael S. Branicky_, Jul 22 2021

%o (PARI) a(n) = { my(q = floor((-3+sqrt(1+8*n))/4), s = [1, 2, 1, 1] + [1, 1, 1, 1] * q, c, b = [2, 0, 4, 5]); n -= (2*q^2 + 3*q); for(i = 1, 4, if(s[i] < n, n-=s[i] , c = i; break; ) ); qd = ceil(6*q + 3*c/2+7/2); 10^qd\9 + 6*10^(6*(n-1)+b[c]) } \\ _David A. Corneth_, Jul 23 2021

%Y Cf. A107693, A346274.

%K nonn,base,easy

%O 1,1

%A _Bernard Schott_, Jul 22 2021