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: Gleb Ivanov

Gleb Ivanov's wiki page.

Gleb Ivanov has authored 20 sequences. Here are the ten most recent ones:

A358178 a(n) is the cardinality of the set of distinct pairwise gcd's of {1! + 1, ..., n! + 1}.

Original entry on oeis.org

0, 1, 1, 1, 1, 2, 2, 2, 3, 4, 4, 4, 4, 4, 4, 5, 6, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 9, 9, 9, 9, 9, 10, 10, 11, 12, 12, 12, 13, 14, 14, 15, 15, 15, 15, 16, 16, 16, 16, 16, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 18, 18, 18, 18, 18, 18, 18, 18, 18
Offset: 1

Author

Gleb Ivanov, Nov 02 2022

Keywords

Examples

			For n = 6 initial set is {1+1, 2+1, 6+1, 24+1, 120+1, 720+1} and after applying gcd for each distinct pair of elements we get {1, 7} set with cardinality of a(6) = 2.
		

Crossrefs

Programs

  • Python
    from math import gcd, factorial
    from itertools import combinations
    f, terms = [2,], []
    for i in range(2,100):
        f.append(factorial(i)+1)
        terms.append(len(set([gcd(*t) for t in combinations(f, 2)])))
    print(terms)
    
  • Python
    from math import gcd
    from itertools import count, islice
    def A358178_gen(): # generator of terms
        m, f, g = 1, [], set()
        for n in count(1):
            m *= n
            g |= set(gcd(d,m+1) for d in f)
            f.append(m+1)
            yield len(g)
    A358178_list = list(islice(A358178_gen(),20)) # Chai Wah Wu, Dec 15 2022

A358154 a(n) is the smallest composite number obtained by appending one or more 1's to n.

Original entry on oeis.org

111, 21, 3111, 411, 51, 611, 711, 81, 91, 1011, 111, 121, 1311, 141, 15111, 161, 171, 18111, 1911, 201, 21111, 221, 231, 24111, 2511, 261, 27111, 2811, 291, 301, 3111, 321, 3311, 341, 351, 361, 371, 381, 391, 4011, 411, 42111, 4311, 441, 451, 4611, 471, 481, 4911, 501, 511, 5211, 531, 5411
Offset: 1

Author

Gleb Ivanov, Nov 01 2022

Keywords

Comments

a(n) is either 10*n+1, 100*n+11 or 1000*n+111, because at least one of these is divisible by 3. - Robert Israel, Nov 01 2022
Actually: exactly one of these is divisible by 3. Almost all terms are a(n) = 10n + 1: this is the case for about (k-1)/k of the terms up to 10^k (i.e., 69% ~ 2/3 up to 10^3, 76% = 3/4 up to 10^4, 80% = 4/5 up to 10^5, 83% = 5/6 up to 10^6). - M. F. Hasler, Nov 03 2022

Crossrefs

Programs

  • Maple
    f:= proc(n) local x;
       x:= n;
       do
         x:= 10*x+1;
         if not isprime(x) then return x fi;
       od
    end proc:
    map(f, [$1..100]); # Robert Israel, Nov 01 2022
  • Mathematica
    a[n_] := NestWhile[10*# + 1 &, 10*n + 1, ! CompositeQ[#] &]; Array[a, 54] (* Amiram Eldar, Nov 01 2022 *)
  • PARI
    a(n) = my(d=digits(n), m); if (!isprime(n), d = concat(d, 1)); while(isprime(m=fromdigits(d)), d=concat(d, 1)); m; \\ Michel Marcus, Nov 01 2022
  • Python
    from sympy import isprime
    def A358154(n):
        t = str(n)+'1'
        while isprime(int(t)):t=t+'1'
        return int(t)
    print([A358154(i) for i in range(1, 100)])
    

A358615 Record high values in A358497.

Original entry on oeis.org

1, 12, 122, 123, 1222, 1223, 1232, 1233, 1234, 12222, 12223, 12232, 12233, 12234, 12322, 12323, 12324, 12332, 12333, 12334, 12342, 12343, 12344, 12345, 122222, 122223, 122232, 122233, 122234, 122322, 122323, 122324, 122332, 122333, 122334, 122342, 122343, 122344
Offset: 1

Author

Gleb Ivanov, Nov 23 2022

Keywords

Crossrefs

Programs

  • Python
    def A358497(n):
        d, s, k = dict(), str(n), 1
        for i in range(len(s)):
            if d.get(s[i], 0) == 0:
                d[s[i]] = str(k)
                k = (k + 1)%10
        s_t = list(s)
        for i in range(len(s)):s_t[i] = d[s[i]]
        return int(''.join(s_t))
    terms = [1,]
    for i in range(1, 10**6):
        if A358497(i)>terms[-1]:terms.append(A358497(i))
    print(terms)

A358497 Replace each new digit in n with index 1, 2, ..., 9, 0 in order in which that digit appears in n, from left to right.

Original entry on oeis.org

1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 12, 11, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 11, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 11, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 11, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 11, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 11, 12
Offset: 0

Author

Gleb Ivanov, Nov 19 2022

Keywords

Comments

a(n) gives the canonical form which enumerates digits in order of their first occurrence in n, from left to right. a(n) uniquely defines the pattern of identical digits in n. - Dmytro Inosov, Jul 16 2024

Examples

			n = 10 has 2 different digits; replace first encountered digit 1 -> 1, replace second digit 0 -> 2, therefore a(10) = 12.
n = 141 has 3 digits, but only 2 different ones; replace first encountered digit 1 -> 1, replace second encountered digit 4 -> 2, therefore a(141) = 121.
		

Crossrefs

Cf. A071159, A227362, A358615 (record high values).

Programs

  • Mathematica
    A358497[k_] := With[{pI = Values@PositionIndex@IntegerDigits@k}, MapIndexed[#1 -> Mod[#2[[1]], 10] &, pI, {2}] // Flatten // SparseArray // FromDigits]; (* Dmytro Inosov, Jul 15 2024 *)
  • PARI
    a(n) = {if(n == 0, return(1)); my(d = digits(n), m = Map(), t = 0); for(i = 1, #d, if(mapisdefined(m, d[i]), d[i] = mapget(m, d[i]) , t++; if(t == 10, t = 0); mapput(m, d[i], t); d[i] = t ) ); fromdigits(d) } \\ David A. Corneth, Nov 23 2022
  • Python
    def A358497(n):
        d,s,k = dict(),str(n),1
        for i in range(len(s)):
            if d.get(s[i],0) == 0:
                d[s[i]] = str(k)
                k = (k + 1)%10
        s_t = list(s)
        for i in range(len(s)):s_t[i] = d[s[i]]
        return int(''.join(s_t))
    print([A358497(i) for i in range(100)])
    
  • Python
    def A358497(n):
        s, c, i  = str(n), {}, 49
        for d in map(ord,s):
            if d not in c:
                c[d] = i
                i += 1
        return int(s.translate(c)) # Chai Wah Wu, Jul 09 2024
    

Formula

a(a(n)) = a(n). - Dmytro Inosov, Jul 16 2024

A358127 a(n) is the cardinality of the set of pairwise gcd's of {prime(1)+1, ..., prime(n)+1}.

Original entry on oeis.org

1, 3, 4, 5, 5, 5, 5, 7, 8, 8, 8, 9, 9, 11, 12, 14, 14, 14, 14, 14, 14, 15, 15, 15, 16, 16, 18, 19, 20, 21, 22, 22, 23, 23, 23, 23, 23, 24, 24, 26, 27, 29, 29, 30, 32, 32, 33, 35, 36, 36, 37, 37, 37, 37, 38, 38, 39, 39, 39, 39, 40, 40, 42, 42, 43, 43, 43, 44, 45, 45, 48, 48, 48, 48, 50, 50, 50, 50
Offset: 2

Author

Gleb Ivanov, Oct 30 2022

Keywords

Examples

			For n = 3 initial set is {2+1, 3+1, 5+1} and after applying gcd for each distinct pair of elements we get {1, 2, 3} set with cardinality of a(3) = 3.
		

Crossrefs

Programs

  • Python
    from sympy import nextprime
    from math import gcd
    from itertools import combinations
    pr, terms = [2,3], []
    for i in range(100):
        terms.append(len(set([gcd(t[0]+1, t[1]+1) for t in combinations(pr,2)])))
        pr.append(nextprime(pr[-1]))
    print(terms)
    
  • Python
    from math import gcd
    from itertools import count, islice
    from sympy import prime
    def A358127_gen(): # generator of terms
        a, b = [3], set()
        for n in count(2):
            q = prime(n)+1
            b |= set(gcd(p,q) for p in a)
            yield len(b)
            a.append(q)
    A358127_list = list(islice(A358127_gen(),100)) # Chai Wah Wu, Nov 02 2022

A357195 a(n) is the smallest palindrome of the form k*(2*n+k-1)/2 where k is a positive integer.

Original entry on oeis.org

1, 2, 3, 4, 5, 6, 7, 8, 9, 33, 11, 969, 222, 99, 66, 33, 242, 282, 424, 161, 66, 22, 212, 252, 646, 171, 55, 252, 414, 555, 525, 99, 33, 474, 1001, 111, 5005, 77, 484, 1111, 1881, 414, 808, 44, 606, 141, 404, 303, 99, 101, 555, 444, 333, 222, 55, 171, 484
Offset: 1

Author

Gleb Ivanov, Sep 17 2022

Keywords

Crossrefs

Programs

  • PARI
    ispal(p) = my(d=digits(p)); d==Vecrev(d);
    a(n) = my(k=1); while(!ispal(x=k*(2*n+k-1)/2), k++); x; \\ Michel Marcus, Sep 17 2022
  • Python
    pal10 = lambda n: str(n) == str(n)[::-1]
    def seq(n):
        k = 1
        while not pal10(k*(2*n+k-1)//2):k+=1
        return k*(2*n+k-1)//2
    print([seq(n) for n in range(1, 100)])
    
  • Python
    from itertools import count
    def A357195(n): return next(filter(lambda n:(s := str(n))[:(t:=len(s)+1>>1)]==s[:-t-1:-1],(k*((n<<1)+k-1)>>1 for k in count(1)))) # Chai Wah Wu, Oct 29 2022
    

A357126 a(n) is the smallest positive integer k such that k > n and A071364(k) = A071364(n).

Original entry on oeis.org

3, 5, 9, 7, 10, 11, 27, 25, 14, 13, 20, 17, 15, 21, 81, 19, 50, 23, 28, 22, 26, 29, 40, 49, 33, 125, 44, 31, 42, 37, 243, 34, 35, 38, 100, 41, 39, 46, 56, 43, 66, 47, 45, 52, 51, 53, 80, 121, 75, 55, 63, 59, 250, 57, 88, 58, 62, 61, 84, 67, 65, 68, 729, 69, 70, 71, 76, 74, 78, 73, 200, 79, 77, 98
Offset: 2

Author

Gleb Ivanov, Oct 26 2022

Keywords

Examples

			a(12) = 20 as 12 has (2, 1) sequence of exponents in canonical prime factorization via 12 = 2^2 * 3^1 and the smallest positive integer > 12 with the same sequence of exponents in canonical prime factorization being (2, 1) is 20 as 20 = 2^2 * 5^1. - _David A. Corneth_, Oct 26 2022
		

Programs

  • PARI
    f4(n) = my(f = factor(n)); for (i=1, #f~, f[i, 1] = prime(i)); factorback(f); \\ A071364
    a(n) = my(k=n+1, f=f4(n)); while (f4(k) != f, k++); k; \\ Michel Marcus, Oct 26 2022
    
  • PARI
    first(n) = { my(res = vector(n + 1), todo = n, m = Map(), u = precprime(n)); for(e = 2, logint(n, 2), u = max(u, nextprime(sqrtnint(n, e) + 2)^e) ); forfactored(i = 2, u, cs = i[2][,2]; if(mapisdefined(m, cs), ci = mapget(m, cs); if(ci <= n + 1, res[ci] = i[1]; mapput(m, cs, i[1]); todo--; if(todo <= 0, res = res[^1]; return(res) ) ) , if(i[1] <= n + 1, mapput(m, cs, i[1]) ) ) ) } \\ David A. Corneth, Oct 26 2022
  • Python
    from sympy import factorint
    to_s_exp = lambda n: tuple(i[1] for i in sorted(factorint(n).items()))
    terms = []
    for i in range(2, 100):
        k = i+1;t = to_s_exp(i)
        while t != to_s_exp(k):k+=1
        terms.append(k)
    print(terms)
    

Formula

a(A000961(k)) = a(A003961(A000961(k))) for k > 1. - David A. Corneth, Oct 26 2022
a(n) >= A081761(n). - Rémy Sigrist, Feb 16 2023

A357314 a(1) = 1; a(n) is the second smallest number k such that k > a(n-1) and concatenation of a(1), ..., a(n-1), k is a palindrome.

Original entry on oeis.org

1, 21, 1121, 1211121, 2111211211121, 112112111212111211211121, 12111212111211211121112112111212111211211121, 211121121112111211211121211121121112112111212111211211121112112111212111211211121
Offset: 1

Author

Gleb Ivanov, Sep 23 2022

Keywords

Comments

Conjecture: Length A055642(a(n)) = A000073(n+2), and A305393 is a sequence of digits in the concatenation of all terms in this sequence.

Examples

			For n = 3 concatenation of the previous terms is 121. Numbers that would make it a palindrome if concatenated to it are 121, 1121, ... and the second smallest of them is a(3) = 1121.
		

Crossrefs

Programs

  • Python
    pal = lambda s: s == s[::-1]
    up_to = 10
    terms = [1, ]
    for i in range(up_to-1):
        c, r = ''.join(map(str, terms)), 0
        for j in range(len(str(terms[-1])), len(c)+1):
            found, p  = False, int(c[:j][::-1])
            if p > terms[-1] and pal(c + c[:j][::-1]):
                r+=1
                if r == 2:
                    terms.append(p);found = True;break
        if found: continue
        j = 0
        while 1:
            j+=1
            r+=1
            if r == 2:
                terms.append(int(str(j) + c[::-1]))
                break
    print(terms)

A356371 a(n) is the smallest positive integer k, such that set of pairwise gcd of k, k+1, ..., k+n has a cardinality of n.

Original entry on oeis.org

1, 2, 3, 8, 15, 24, 35, 48, 63, 270, 440, 528, 780, 1078, 2925, 1440, 8160, 2142, 5472, 34560, 23919, 235598, 64239, 42480, 158400, 1255800, 1614600, 1247400, 16442971, 8233650, 41021370, 21561120, 127327167, 439824000, 439824000, 24504444, 1329112224, 1653775162
Offset: 1

Author

Gleb Ivanov, Oct 17 2022

Keywords

Comments

n | a(n). - David A. Corneth, Oct 17 2022

Crossrefs

Cf. A214799.

Programs

  • Mathematica
    a[n_] := Module[{k = 1}, While[Length[Union[GCD @@@ Subsets[k + Range[0, n], {2}]]] != n, k++]; k]; Array[a, 20] (* Amiram Eldar, Oct 17 2022 *)
  • Python
    from math import gcd
    from itertools import count
    def A356371(n):
        for k in count(n,n):
            if len(set(gcd(i,j) for i in range(k,n+k+1) for j in range(i+1,n+k+1))) == n:
                return k # Chai Wah Wu, Oct 18 2022

Extensions

a(31)-a(38) from Giovanni Resta, Oct 17 2022

A355966 Number of 3-dimensional polyominoes (or polycubes) with n cells that have cavities (inclusions of empty space).

Original entry on oeis.org

20, 404, 6164, 75917, 835491
Offset: 11

Author

Gleb Ivanov, Jul 21 2022

Keywords

Comments

Even if two polycubes are mirror images of each other, they are considered different for this sequence.
Polycubes with less than 11 cells can't have cavities.
Largest enclosed volume >= A355880(n-5) for polycubes with n cells.

Crossrefs

Cf. A357083 (without distinguished reflections).