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: Tadayoshi Kamegai

Tadayoshi Kamegai's wiki page.

Tadayoshi Kamegai has authored 3 sequences.

A372142 a(n) is the smallest prime p such that there exist exactly n distinct primes q where q < p and the representation of p in base q is a palindrome.

Original entry on oeis.org

2, 3, 31, 443, 23053, 86677, 11827763, 27362989, 755827199, 1306369439
Offset: 0

Author

Tadayoshi Kamegai, Apr 21 2024

Keywords

Comments

This is a special case of A372141.
It need not be the case that a(n) is a palindrome in base 2, as 23053 is a counterexample.
For p > 3, one only needs to check q such that q^2 + 1 <= p else p = cc_q = c*(q+1), not prime for c != 1 and q != 2. A similar argument shows that p cannot have an even number of digits in base q, else it would be divisible by (q+1). - Michael S. Branicky, Apr 21 2024

Examples

			a(5) = 86677, as it is palindromic in base 2, 107, 113, 151, and 233, and no smaller number satisfies the property.
		

Crossrefs

Programs

  • Python
    from math import isqrt
    from sympy import sieve
    from sympy.ntheory import digits
    from itertools import islice
    def ispal(v): return v == v[::-1]
    def f(p): return sum(1 for q in sieve.primerange(1, isqrt(p-1)+1) if ispal(digits(p, q)[1:]))
    def agen():
        adict, n = {0:2, 1:3}, 0
        for p in sieve:
            v = f(p)
            if v >= n and v not in adict:
                adict[v] = p
                while n in adict:
                    yield adict[n]; del adict[n]; n += 1
    print(list(islice(agen(), 6))) # Michael S. Branicky, Apr 21 2024

Extensions

a(6) from Jon E. Schoenfield, Apr 21 2024
a(7) from Michael S. Branicky, Apr 21 2024
a(8) from Michael S. Branicky, Apr 22 2024
a(9) from Michael S. Branicky, Apr 24 2024

A372141 Primes p that are palindromic in some prime base q, where q < p.

Original entry on oeis.org

3, 5, 7, 13, 17, 23, 31, 41, 67, 71, 73, 83, 107, 109, 127, 151, 157, 173, 199, 233, 257, 271, 277, 307, 313, 353, 379, 409, 419, 421, 431, 443, 457, 499, 521, 523, 571, 587, 599, 601, 631, 643, 647, 653, 691, 701, 709, 719, 733, 743, 757, 787, 797, 809, 823, 829, 857, 863, 887
Offset: 1

Author

Tadayoshi Kamegai, Apr 20 2024

Keywords

Comments

If we remove either constraint of q < p or q being prime, then the sequence would be all prime numbers (A000040).
By definition it is a superset of A016041, and is a proper superset by construction (e.g., 13 is in the sequence).
Some terms have multiple bases that yield palindromic representations, the first being 31 (which is palindromic in both base 2 and base 5). The smallest prime p such that there exist n distinct primes less than p that give palindromic representations of p is A372142(n).

Examples

			11 is not in this sequence as its representation in base 2 is 1011, in base 3 is 102, in base 5 is 21, in base 7 is 14, none of which are palindromic.
1483 is in this sequence as its representation in base 37 is 131, which is palindromic.
		

Crossrefs

Programs

  • Mathematica
    a={}; For[i=1, i<=155, i++, flag=0; For[j=1, Prime[j] < Prime[i] && flag==0, j++, If[PalindromeQ[IntegerDigits[Prime[i], Prime[j]]], flag=1; AppendTo[a, Prime[i]]]]]; a (* Stefano Spezia, Apr 22 2024 *)
  • Python
    from sympy import sieve
    from sympy.ntheory import digits
    from itertools import islice
    def ispal(v): return v == v[::-1]
    def agen(): yield from (p for p in sieve if any(ispal(digits(p, q)[1:]) for q in sieve.primerange(1, p)))
    print(list(islice(agen(), 60))) # Michael S. Branicky, Apr 20 2024

A369580 a(n) := f(n, n), where f(0,0) = 1/3, f(0,k) = 0 and f(k,0) = 3^(k-1) if k > 0, and f(n, m) = f(n, m-1) + f(n-1, m) + 3*f(n-1, m-1) otherwise.

Original entry on oeis.org

2, 16, 138, 1216, 10802, 96336, 861114, 7708416, 69072354, 619380496, 5557080938, 49879087296, 447852531986, 4022246329936, 36132550233498, 324645166734336, 2917340834679234, 26219438520320016, 235672871308226634, 2118552629658530496, 19046140604787232242, 171241206828437556816
Offset: 1

Author

Tadayoshi Kamegai, Jan 26 2024

Keywords

Comments

Take turns flipping a fair coin. The first to n heads wins. Sequence gives numerator of probability of first player winning. The denominator is .3^(2n-1).
It appears that a(n) for any n is divisible by 2^(A001511(n)).

Crossrefs

Cf. A001511 (see comments), A162326 (see formula).

Programs

  • Python
    def lis(n):
        table = [[0]*(n+1) for _ in range(n+1)]
        table[1][1] = 2
        for i in range(1, n+1) :
            table[i][0] = 3**(i-1)
        for i in range(1, n+1) :
            for j in range(1, n+1) :
                if (i == 1 and j == 1) :
                    continue
                table[i][j] = table[i][j-1] + table[i-1][j] + 3*table[i-1][j-1]
        return [int(table[i][i]) for i in range(1, n+1)]

Formula

Limit_{n->oo} a(n)/3^(2n-1) = 1/2.
a(n) = Sum_{i>=n} Sum_{j=0..n-1} binomial(i-1,n-1)*binomial(i-1,j)*3^(2n-1)/2^(2i-1).
9*a(n) - a(n+1) = 2*A162326(n) (conjectured).
a(n) = 3^(2n-1)*A(n, n) where A(0, k) = 0 for k > 0, A(k, 0) = 1 for k >= 0 and A(n, m) = (A(n-1, m) + A(n, m-1) + A(n-1, m-1))/3.