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.

User: Ali Sada

Ali Sada's wiki page.

Ali Sada has authored 99 sequences. Here are the ten most recent ones:

A387242 a(n) is the least k such that A334676(k) != k and the decimal string of n appears in A334676(k).

Original entry on oeis.org

2, 42, 26, 28, 102, 32, 85, 172, 95, 20, 22, 242, 26, 28, 302, 32, 85, 236, 95, 402, 42, 442, 115, 482, 502, 522, 162, 562, 145, 260, 62, 1615, 266, 268, 712, 272, 148, 772, 278, 802, 82, 842, 215, 882, 902, 92, 235, 962, 245, 1002, 102, 1042, 265, 1078, 1102, 112, 285, 1162
Offset: 1

Author

Ali Sada, Aug 23 2025

Keywords

Examples

			A334676(242) = 121, the first term whose decimal expansion contains the substring "12"; hence a(12) = 242.
A334676(21) = A334676(42) = 21 contains "2" but a(2) = 42 since the first does not satisfy A334676(k) != k.
		

Crossrefs

Cf. A334676.

Programs

  • Python
    # uses A334676() and neighs() from A334676
    from itertools import count, islice
    def subs(s): yield from (s[i:j] for i in range(len(s)) for j in range(i+1, len(s)+1))
    def agen(): # generator of terms
        adict, n = dict(), 1
        for k in count(1):
            v = A334676(k)
            if v != k:
                for t in subs(str(v)):
                    if (ti:=int(t)) not in adict:
                        adict[ti] = k
                        while n in adict:
                            yield adict[n]
                            n += 1
    print(list(islice(agen(), 70))) # Michael S. Branicky, Aug 23 2025

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

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

A387070 Remove every digit that appears in n from the decimal representation of n^2. If no digits remain, set a(n) = 0.

Original entry on oeis.org

0, 0, 4, 9, 16, 2, 3, 49, 64, 81, 0, 2, 44, 69, 96, 22, 25, 289, 324, 36, 4, 44, 484, 59, 576, 6, 7, 9, 74, 841, 9, 96, 104, 1089, 1156, 122, 129, 169, 1444, 1521, 16, 68, 176, 189, 1936, 202, 211, 2209, 230, 201, 2, 260, 704, 2809, 2916, 302, 313, 3249, 3364, 3481, 3, 372, 3844, 99, 9, 422, 435
Offset: 0

Author

Ali Sada, Aug 15 2025

Keywords

Examples

			a(25) = 6 since 25^2 = 625 and once we remove the 2 and 5, we are left with 6.
a(26) = 7 since 26^2 = 676 and once we remove the 6, we are left with 7.
		

Crossrefs

Programs

  • Mathematica
    a[n_] := FromDigits[Select[IntegerDigits[n^2], FreeQ[IntegerDigits[n], #] &]]; Array[a, 100, 0] (* Amiram Eldar, Aug 16 2025 *)
  • PARI
    a(n)={my(S=Set(digits(n))); fromdigits(select(x->!setsearch(S,x), digits(n^2)))} \\ Andrew Howroyd, Aug 15 2025
    
  • Python
    def A387070(k):
        s = set(str(k))
        t = "".join(d for d in str(k**2) if d not in s)
        return int(t) if t != "" else 0
    print([A387070(n) for n in range(67)]) # Michael S. Branicky, Aug 16 2025

Formula

a(n) = A258682(n) for n <= 19.
From David A. Corneth, Aug 16 2025: (Start)
a(A029793(k)) = 0.
a(A029783(k)) = A029783(k)^2. (End)

A386395 Smallest final number reachable from n by successively replacing a substring of digits with its square root.

Original entry on oeis.org

1, 2, 3, 2, 5, 6, 7, 8, 3, 10, 11, 12, 13, 12, 15, 2, 17, 18, 13, 20, 21, 22, 23, 22, 5, 26, 27, 28, 23, 30, 31, 32, 33, 32, 35, 6, 37, 38, 33, 20, 21, 22, 23, 22, 5, 26, 27, 28, 7, 50, 51, 52, 53, 52, 55, 56, 57, 58, 53, 60, 61, 62, 63, 8, 65, 66, 67, 68, 63, 70, 71, 72, 73, 72, 75, 76, 77, 78, 73, 80, 3, 82, 83, 82
Offset: 1

Author

Ali Sada, Jul 20 2025

Keywords

Comments

The substring replaced must be a square and cannot begin with a 0 digit.
There may be multiple different replacements possible and the aim is whatever steps reach the smallest final value.

Examples

			425 -> 25 -> 5.
1004 -> 102.
6251 -> 251 -> 51.
9616 -> 3616 -> 196 -> 136 -> 16 -> 4 -> 2.
9996 -> 9936 -> 996 -> 936 -> 96 -> 36 -> 6.
		

Crossrefs

Programs

  • Python
    from math import isqrt
    def children(n):
        s = str(n)
        return set(int(s[:i]+str(r)+s[j:]) for i in range(len(s)) for j in range(i+1, len(s)+1) if (w:=s[i:j])[0]!='0' and (r:=isqrt(t:=int(w)))**2 == t)
    def a(n):
        reach, expand = {n}, [n]
        while expand:
            q = expand.pop()
            for c in children(q):
                if c not in reach:
                    reach.add(c)
                    expand.append(c)
        return min(reach)
    print([a(n) for n in range(1, 85)]) # Michael S. Branicky, Jul 20 2025

A385342 Square array A(n,k) read by descending antidiagonals, where each row n starts with an ordered list of positive integers then we swap A(n,k) with the number in the position A(n, A(n,k*n)).

Original entry on oeis.org

1, 2, 2, 3, 1, 3, 4, 6, 6, 4, 5, 8, 1, 8, 5, 6, 10, 12, 12, 10, 6, 7, 12, 15, 1, 15, 3, 7, 8, 14, 18, 20, 20, 2, 14, 8, 9, 16, 21, 24, 1, 24, 21, 4, 9, 10, 18, 24, 28, 30, 30, 28, 24, 18, 10, 11, 20, 27, 32, 35, 1, 35, 2, 27, 5, 11, 12, 22, 30, 36, 40, 42, 42, 40, 36, 30, 22, 12
Offset: 1

Author

Ali Sada, Jun 26 2025

Keywords

Comments

The lower triangular array is the multiplication table.
The second row is A073675.
The first superdiagonal and the first subdiagonal are both A002378.

Examples

			The square array begins:
  1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, ...
  2, 1, 6, 8, 10, 3, 14, 4, 18, 5, 22, 24, 26, 7, 30, 32, 34, ...
  3, 6, 1, 12, 15, 2, 21, 24, 27, 30, 33, 4, 39, 42, 5, 48, 51, ...
  4, 8, 12, 1, 20, 24, 28, 2, 36, 40, 44, 3, 52, 56, 60, 64, 68, ...
  5, 10, 15, 20, 1, 30, 35, 40, 45, 2, 55, 60, 65, 70, 3, 80, 85, ...
  6, 12, 18, 24, 30, 1, 42, 48, 54, 60, 66, 2, 78, 84, 90, 96, 102, ...
  7, 14, 21, 28, 35, 42, 1, 56, 63, 70, 77, 84, 91, 2, 105, 112, 119, ...
  8, 16, 24, 32, 40, 48, 56, 1, 72, 80, 88, 96, 104, 112, 120, 2, 136, ...
  9, 18, 27, 36, 45, 54, 63, 72, 1, 90, 99, 108, 117, 126, 135, 144, 153, ...
  10, 20, 30, 40, 50, 60, 70, 80, 90, 1, 110, 120, 130, 140, 150, 160, 170, ...
		

Crossrefs

A384908 Start with a list L of positive integers. At each step n, let the center be the smallest number that has not been used as a center before with index m > 1. For all i < m, swap L(i) with L(i+m). a(n) = L(1).

Original entry on oeis.org

3, 4, 2, 5, 7, 1, 3, 9, 11, 4, 12, 6, 16, 15, 17, 5, 12, 19, 21, 8, 20, 23, 25, 10, 24, 27, 23, 21, 11, 31, 33, 34, 32, 35, 37, 31, 16, 33, 15, 41, 43, 17, 44, 18, 12, 47, 49, 50, 48, 51, 53, 47, 49, 55, 57, 50, 22, 59, 61, 26, 60, 29, 64, 66, 61, 67, 69, 70, 68, 65, 72, 28, 64, 75, 54, 27, 78, 80, 56
Offset: 1

Author

Ali Sada, Jun 12 2025

Keywords

Examples

			Start with 1,2,3,4,5,6,.. The first number with index > 1 that has not been used as a center is 2, so it becomes the center and the list becomes 3,2,1,4,5,6.. and a(1) = 3. Now, the center is 1 and the list becomes 4,5,1,3,2,6,7.. and a(n) = 4. Now, the center is 3 (since 1 has already been used as a center) and the list becomes 2,6,7,3,1,5,4,8,9.. and a(n) = 2, and so on.
		

Programs

  • Python
    from itertools import count, islice
    def agen(): # generator of terms
        L, nextL, mink, cset = [1, 2], 3, 1, set() # cset is set of centers used
        while True:
            c, m = next((k, i) for k in count(mink) if k not in cset and (i:=L.index(k))>0)
            if len(L) < 2*m+1:
                L += list(range(nextL, 2*m+2))
                nextL = 2*m+2
            for i in range(m):
                L[i], L[i+m+1] = L[i+m+1], L[i]
            while mink in cset:
                mink += 1
            yield L[0]
            cset.add(c)
    print(list(islice(agen(), 80))) # Michael S. Branicky, Jun 12 2025

A384034 Irregular triangle read by rows. Start with T(1,1) = 1. For each subsequent row, traverse the array so far. For each value m, insert m new values from the next unused integers immediately to the right of m. The process is repeated row by row, where each number in the array dictates how many new values are added after it.

Original entry on oeis.org

1, 1, 2, 1, 3, 2, 4, 5, 1, 6, 3, 7, 8, 9, 2, 10, 11, 4, 12, 13, 14, 15, 5, 16, 17, 18, 19, 20, 1, 21, 6, 22, 23, 24, 25, 26, 27, 3, 28, 29, 30, 7, 31, 32, 33, 34, 35, 36, 37, 8, 38, 39, 40, 41, 42, 43, 44, 45, 9, 46, 47, 48, 49, 50, 51, 52, 53, 54, 2, 55, 56
Offset: 1

Author

Ali Sada, May 21 2025

Keywords

Examples

			Triangle begins:
  1;
  1, 2;
  1, 3, 2, 4, 5;
  1, 6, 3, 7, 8, 9, 2, 10, 11, 4, 12, 13, 14, 15, 5, 16, 17, 18, 19, 20;
  ...
Row 1 = [1].
For m = 1, insert 1 new integer (next unused is 2) to the right of 1.
Row 2 = [1, 2].
For m = 1, insert 1 new integer (next unused is 3) to the right of 1.
For m = 2, insert 2 new integers (next unused are 4, 5) to the right of 2.
Row 3 = [1, 3, 2, 4, 5].
For m = 1, insert 1 new integer (6).
For m = 3, insert 3 new integers (7, 8, 9).
For m = 2, insert 2 new integers (10, 11).
For m = 4, insert 4 new integers (12, 13, 14, 15).
For m = 5, insert 5 new integers (16, 17, 18, 19, 20).
Row 4 = [1, 6, 3, 7, 8, 9, 2, 10, 11, 4, 12, 13, 14, 15, 5, 16, 17, 18, 19, 20].
And so on.
		

A383789 a(1) = 1; for n > 1, a(n) is the smallest positive integer not already in the sequence such that it shares at least one digit with a(n-1), and it has a different number of digits from a(n-1).

Original entry on oeis.org

1, 10, 100, 11, 101, 12, 2, 20, 102, 13, 3, 23, 103, 14, 4, 24, 104, 15, 5, 25, 105, 16, 6, 26, 106, 17, 7, 27, 107, 18, 8, 28, 108, 19, 9, 29, 109, 21, 110, 30, 113, 31, 111, 41, 112, 22, 120, 32, 121, 42, 114, 34, 123, 33, 130, 35, 115, 45, 124, 40, 134, 36, 116, 46, 126, 51, 117, 37, 127, 47, 137
Offset: 1

Author

Ali Sada, May 09 2025

Keywords

Examples

			a(6) = 12, and 2 is the smallest number not already in the sequence that shares a digit with 12 and has a different number of digits. So, a(7) = 2.
		

Crossrefs

Programs

  • Magma
    function MySequence(N) a := [1]; while #a lt N do prev := a[#a]; d := Intseq(prev); m := #d; k := 2; repeat is_used := k in a; inter := &and[not x in d : x in Intseq(k)]; len_eq := #Intseq(k) eq m; k +:= 1; until not is_used and not inter and not len_eq; Append(~a, k - 1); end while; return a; end function; MySequence(100); // Vincenzo Librandi, May 17 2025
  • Mathematica
    a[1] = 1; a[n_] := a[n] = Module[{k = 2, s = Array[a, n-1], d = IntegerDigits[a[n-1]], m = IntegerLength[a[n-1]]}, While[! FreeQ[s, k] || Intersection[IntegerDigits[k], d] == {} || IntegerLength[k] == m, k++]; k]; Array[a, 100] (* Amiram Eldar, May 10 2025 *)
  • PARI
    isok(k, nbd, s, va) = if (#select(x->(x==k), va), return(0)); my(d=digits(k)); if (#setintersect(Set(d), s) && (#d != nbd), return(1));
    find(va, n) = my(k=2, d=digits(va[n-1]), nbd=#d, s=Set(d)); while (!isok(k, nbd, s, va), k++); k;
    lista(nn) = my(va = vector(nn)); va[1] = 1; for (n=2, nn, va[n] = find(va, n);); va; \\ Michel Marcus, May 13 2025
    

A383787 Largest number obtainable by either keeping each decimal digit d in n or replacing it with 9-d.

Original entry on oeis.org

8, 7, 6, 5, 5, 6, 7, 8, 9, 89, 88, 87, 86, 85, 85, 86, 87, 88, 89, 79, 78, 77, 76, 75, 75, 76, 77, 78, 79, 69, 68, 67, 66, 65, 65, 66, 67, 68, 69, 59, 58, 57, 56, 55, 55, 56, 57, 58, 59, 59, 58, 57, 56, 55, 55, 56, 57, 58, 59, 69, 68, 67, 66, 65, 65, 66, 67, 68, 69, 79, 78, 77, 76, 75, 75, 76, 77, 78
Offset: 1

Author

Ali Sada, May 09 2025

Keywords

Examples

			To find a(129) we replace 1 with 8 and 2 with 7. So, a(129) = 879.
		

Crossrefs

Programs

  • Mathematica
    a[n_] := FromDigits[IntegerDigits[n] /. d_?(# < 5 &) -> 9 - d]; Array[a, 100] (* Amiram Eldar, May 10 2025 *)
  • PARI
    a(n) = fromdigits(apply(x->(if (x<5, 9-x, x)), digits(n))); \\ Michel Marcus, May 12 2025
  • Python
    def a(n): return int("".join(d if d>"4" else str(9-int(d)) for d in str(n)))
    print([a(n) for n in range(1, 79)]) # Michael S. Branicky, May 10 2025
    

A383788 Smallest number obtainable by either keeping each decimal digit d in n or replacing it with 9-d.

Original entry on oeis.org

1, 2, 3, 4, 4, 3, 2, 1, 0, 10, 11, 12, 13, 14, 14, 13, 12, 11, 10, 20, 21, 22, 23, 24, 24, 23, 22, 21, 20, 30, 31, 32, 33, 34, 34, 33, 32, 31, 30, 40, 41, 42, 43, 44, 44, 43, 42, 41, 40, 40, 41, 42, 43, 44, 44, 43, 42, 41, 40, 30, 31, 32, 33, 34, 34, 33, 32, 31, 30, 20, 21, 22, 23, 24, 24, 23, 22
Offset: 1

Author

Ali Sada, May 09 2025

Keywords

Examples

			To find a(346), we replace 6 with 3. So, a(346) = 343.
		

Crossrefs

Programs

  • Mathematica
    a[n_] := FromDigits[IntegerDigits[n] /. d_?(# > 4 &) -> 9 - d]; Array[a, 100] (* Amiram Eldar, May 10 2025 *)
  • PARI
    a(n) = fromdigits(apply(x->(if (x>4, 9-x, x)), digits(n))); \\ Michel Marcus, May 12 2025
  • Python
    def a(n): return int("".join(d if d<"5" else str(9-int(d)) for d in str(n)))
    print([a(n) for n in range(1, 78)]) # Michael S. Branicky, May 10 2025