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-1 of 1 results.

A387071 a(n) is the least k such that A387070(k) = n. If no such k exists, a(n) = -1.

Original entry on oeis.org

0, 276, 5, 6, 2, 76, 25, 26, 261, 3, 2985, 642, 3606, 462, 320, 3694, 4, 3205, 2045, 643, 493, 96, 15, 106, 318, 16, 510, 963, 1091, 503, 452, 2705, 550, 482, 1520, 1169, 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
Offset: 0

Views

Author

Ali Sada, Aug 15 2025

Keywords

Comments

If the definition of A387070 assigned -1 in the case of all digits being removed, then a(0) would be 1245 in this sequence.
Question: What is the greatest number of distinct digits of n such that a(n) != -1?
From Andrew Howroyd, Aug 16 2025: (Start)
a(1975308269136) = 4444444 shows that it is possible for 9 distinct digits to appear in n with a(n) != -1.
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)
From David A. Corneth, Aug 17 2025: (Start)
n and a(n) can have no digits in common for n > 0.
a(n) is not divisible by 100.
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.
a(1234567) = -1.
Proof by contradiction:
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.
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)
From Michael S. Branicky, Aug 18 2025: (Start)
The first term for which no such k exists is a(12463) = -1.
Proof. a(0..12462) are readily computed (see Python program and b-file).
Assume for the sake of contradiction that n = 12463 and a(n) > 0 exists.
a(n)^2 cannot end in 3, so it must end in one of n's complementary digits: 0, 5, 7, 8 or 9.
If it ends in 9, then a(n) ends in 3, which is not allowed from above since 3 is in n.
7 and 8 are not the ends of squares, so a(n)^2 must end in 5 or 0.
Continuing, a(n)^2 must end in d0 or d5, where d in {3, 5, 7, 8 or 9}.
Only 00 is possible as the two last digits of a square.
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).
Continuing, a(n)^2 can only end in 0000, and a(n) must end in 00.
Contradiction using the Comment proved above. (End)

Examples

			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.
		

Crossrefs

Cf. A387070.

Programs

  • Mathematica
    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 *)
  • PARI
    \\ here b(n) is A387070(n).
    b(n)={my(S=Set(digits(n))); fromdigits(select(x->!setsearch(S,x), digits(n^2)))}
    a(n)={for(k=0, oo, if(b(k)==n, return(k)))} \\ Andrew Howroyd, Aug 15 2025
    
  • Python
    # uses code in A387070
    from itertools import count, product
    def A387071(n):
        if n == 0: return 0
        s = sorted(set("0123456789") - set(str(n)))
        if s == [] or s == ["0"]: return -1
        return next(k for d in count(1) for t in product(s, repeat=d) if A387070(k:=int("".join(t)))==n)
    print([A387071(n) for n in range(68)]) # Michael S. Branicky, Aug 16 2025
Showing 1-1 of 1 results.