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.
%I A387071 #72 Aug 21 2025 11:15:48 %S A387071 0,276,5,6,2,76,25,26,261,3,2985,642,3606,462,320,3694,4,3205,2045, %T A387071 643,493,96,15,106,318,16,510,963,1091,503,452,2705,550,482,1520,1169, %U A387071 19,1462,4512,1428,97,2639,675,2055,12,216,119,6525,2135,7,726,246,674,2146,710,816,74,1026,7401,23,255,2490,75,2510,8,4782,1125,1923 %N A387071 a(n) is the least k such that A387070(k) = n. If no such k exists, a(n) = -1. %C A387071 If the definition of A387070 assigned -1 in the case of all digits being removed, then a(0) would be 1245 in this sequence. %C A387071 Question: What is the greatest number of distinct digits of n such that a(n) != -1? %C A387071 From _Andrew Howroyd_, Aug 16 2025: (Start) %C A387071 a(1975308269136) = 4444444 shows that it is possible for 9 distinct digits to appear in n with a(n) != -1. %C A387071 On the other hand, finding a(n) for particular n is more tricky. For example: a(123) = 99756, a(1234) = 958067, a(12345) = 98980766, a(123456) = 898989898970. It is not clear if a(1234567) != -1. (End) %C A387071 From _David A. Corneth_, Aug 17 2025: (Start) %C A387071 n and a(n) can have no digits in common for n > 0. %C A387071 a(n) is not divisible by 100. %C A387071 Proof: If a(n) is divisible by 100 then a(n) / 10 has the same property. n and a(n) have no digits in common so if n is divisible by 10 then a(n) is not. %C A387071 a(1234567) = -1. %C A387071 Proof by contradiction: %C A387071 If a(1234567) > -1 then a(1234567)^2 ends in 7, 8, 9 or 0 as 8, 9 and 0 are the complementary digits of 1, 2, 3, 4, 5, 6, 7 and the digit before any (0 or more) of them must be 7. %C A387071 The rightmost nonzero digit of a(1234567)^2 must be 9 as 7 and 8 are not square mod 10. If the rightmost nonzero digit of a(1234567)^2 is 9 then the rightmost nonzero digit of a(1234567) is 3 or 7. It would then have a digit in common with 1234567 which is impossible. (End) %C A387071 From _Michael S. Branicky_, Aug 18 2025: (Start) %C A387071 The first term for which no such k exists is a(12463) = -1. %C A387071 Proof. a(0..12462) are readily computed (see Python program and b-file). %C A387071 Assume for the sake of contradiction that n = 12463 and a(n) > 0 exists. %C A387071 a(n)^2 cannot end in 3, so it must end in one of n's complementary digits: 0, 5, 7, 8 or 9. %C A387071 If it ends in 9, then a(n) ends in 3, which is not allowed from above since 3 is in n. %C A387071 7 and 8 are not the ends of squares, so a(n)^2 must end in 5 or 0. %C A387071 Continuing, a(n)^2 must end in d0 or d5, where d in {3, 5, 7, 8 or 9}. %C A387071 Only 00 is possible as the two last digits of a square. %C A387071 Continuing, the only last three digits possible are 500 and 000 (900 is not allowed since a(n) would end in 30, sharing a 3 with n). %C A387071 Continuing, a(n)^2 can only end in 0000, and a(n) must end in 00. %C A387071 Contradiction using the Comment proved above. (End) %H A387071 Michael S. Branicky, <a href="/A387071/b387071.txt">Table of n, a(n) for n = 0..12462</a> (terms 0..10000 from Andrew Howroyd) %e A387071 276 is the smallest number such that, when all of its digits are removed from the decimal representation of its square, 76176, the result is 1. Therefore, a(1) = 276. %t A387071 f[k_] := FromDigits[Select[IntegerDigits[k^2], FreeQ[IntegerDigits[k], #] &]]; seq[max_] := Module[{v = Array[f, max, 0], s = {}, k = 0, i}, While[NumberQ[(i = FirstPosition[v, k][[1]])], AppendTo[s, i - 1]; k++]; s]; seq[10000] (* _Amiram Eldar_, Aug 16 2025 *) %o A387071 (PARI) \\ here b(n) is A387070(n). %o A387071 b(n)={my(S=Set(digits(n))); fromdigits(select(x->!setsearch(S,x), digits(n^2)))} %o A387071 a(n)={for(k=0, oo, if(b(k)==n, return(k)))} \\ _Andrew Howroyd_, Aug 15 2025 %o A387071 (Python) # uses code in A387070 %o A387071 from itertools import count, product %o A387071 def A387071(n): %o A387071 if n == 0: return 0 %o A387071 s = sorted(set("0123456789") - set(str(n))) %o A387071 if s == [] or s == ["0"]: return -1 %o A387071 return next(k for d in count(1) for t in product(s, repeat=d) if A387070(k:=int("".join(t)))==n) %o A387071 print([A387071(n) for n in range(68)]) # _Michael S. Branicky_, Aug 16 2025 %Y A387071 Cf. A387070. %K A387071 sign,base,new %O A387071 0,2 %A A387071 _Ali Sada_, Aug 15 2025