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.

A381526 a(n) is the smallest positive integer k such that the decimal expansion of k is a substring of the decimal expansion of n*k, or -1 if no such number exists.

Original entry on oeis.org

-1, 1, -1, 5, -1, 5, 2, 5, -1, 5, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, -1, 1, 9, 5, 72, 5, 2, 5, 6, 5, 5, 1, 91, 5, 42, 4, 2, 4, 36, 5, -1, 1, 94, 5, 3, 3, 2, 5, 8, 5, 5, 1, 24, 5, 7, 5, 2, 5, 21, 5, 2, 1, 2, 2, 2, 5, 2, 5, 7, 5, 5, 1, 484, 5, 47, 5, 2, 3, 3, 3, -1
Offset: 0

Views

Author

Dominic McCarty, Feb 26 2025

Keywords

Examples

			44*1 = 44 does not have 1 as a substring.
44*2 = 88 does not have 2 as a substring.
44*3 = 132 has 3 as a substring.
So, a(44) = 3.
		

Crossrefs

Cf. A381527 (for n*a(n)), A381528 (records), A239134, A337084.

Programs

  • PARI
    a(n) = if ((n==0) || (n==2) || (n==4) || (n==8), return(-1)); if (n%10, my(k=1); while (#strsplit(Str(n*k), Str(k)) < 2, k++); k, a(n/10)); \\ Michel Marcus, Feb 26 2025
  • Python
    from itertools import count
    def a(n):
        if n in [0, 2, 4, 8]: return -1
        if n % 10 == 0: return a(n//10)
        for k in count(1):
            if str(k) in str(k*n): return k
    print([a(n) for n in range(100)])
    

Formula

a(10*n) = a(n).
a(n) = A381527(n)/n for A381527(n) != -1.
Showing 1-1 of 1 results.