A274368 Numbers k such that if k is decreased by the sum of its digits and k is decreased by the product of its digits both differences are squares > 0.
45, 48, 231, 121116, 159229, 11985489, 17514256, 51624256, 88172137, 228523729, 467597425, 11112111412, 4329279198937, 3716589421762641, 23228676113127556, 138417183479417732388
Offset: 1
Examples
45 - (4 + 5) = 36 and 45 - (4 * 5) = 25. 159229 - (1 + 5 + 9 + 2 + 2 + 9) = 157609 (= 397^2) and 159229 - (1*5*9*2*2*9) = 159201 (= 399^2). From _David A. Corneth_, May 27 2021: (Start) If the digits of a(n) = x are an anagram of 122599 then the product of digits is 1 * 2 * 2 * 5 * 9 * 9 = 1620 and the sum of digits is 1 + 2 + 2 + 5 + 9 + 9 = 28 as order of addition and multiplication does not matter. So x - 31 = m^2 and x - 1620 = k^2 for some positive integers k and m. So m^2 - k^2 = (x - 28) - (x - 1620) = 1592 = (m - k)*(m + k). The divisors of 1592 are 1, 2, 4, 8, 199, 398, 796, 1592. Testing possible pairs m-k and m+k gives, among other pairs, (m - k, m + k) = (2, 796). Solving for k gives k = 397 so x = k^2 + 1620 = 397^2 + 1620 = 159229 giving an extra term. (End)
Programs
-
Mathematica
lim = 10^6; s = Select[Range@ lim, IntegerQ@ # && # != 0 &@ Sqrt[# - Times @@ IntegerDigits@ #] &]; t = Select[Range@ lim, IntegerQ@ # && # != 0 &@ Sqrt[# - Total@ IntegerDigits@ #] &]; Intersection[s, t] (* Michael De Vlieger, Jun 19 2016 *)
-
PARI
a007953(n) = sumdigits(n) a007954(n) = my(d=digits(n)); prod(i=1, #d, d[i]) is(n) = n > 9 && issquare(n-a007953(n)) && issquare(n-a007954(n)) \\ Felix Fröhlich, Jun 19 2016
-
Python
def pod(n): p = 1 for x in str(n): p *= int(x) return p def sod(n): return sum(int(d) for d in str(n)) def cube(z,p): iscube=False y=int(pow(z,1/p)+0.01) if y**p==z: iscube=True return iscube for c in range(1, 10**8): aa,ab=c-pod(c),c-sod(c) if cube(aa,2) and cube(ab,2) and aa>0: print(c,aa,ab)
Extensions
a(10)-a(15) from Giovanni Resta, Jun 19 2016
a(16) from David A. Corneth, May 27 2021
Comments