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

A172514 First prime not the middle of a prime two digits longer in base n.

Original entry on oeis.org

3, 7, 19, 97, 823, 3499, 2777, 6827, 2437, 21523, 300299, 446273, 339769, 1168523, 14117417, 29227421, 14160061, 78521987, 161187707, 1200085823, 2125209127, 1369430897, 56378083771, 26054006611, 76375900241, 290373503549, 640442460709
Offset: 2

Views

Author

James G. Merickel, Feb 05 2010

Keywords

Examples

			In base n=10, 2437 is the least prime such that all numbers of the form x2437y where x and y are digits [1..9] are composite, so a(10)=2437.
		

Crossrefs

Cf. A032734 (in base 10 and not limited to primes).

Programs

  • PARI
    isok(p, n) = my(m=logint(p,n)+1); for (x=1, n-1, my(q = x*n^m+p); for (y=1, n-1, if (isprime(n*q+y), return (0)););); return(1);
    a(n) = my(p=2); while (!isok(p, n), p=nextprime(p+1)); p; \\ Michel Marcus, Sep 04 2022
    
  • Python
    from sympy import isprime, nextprime
    def digits(n, b):
        c = 0
        while n >= b: n //= b; c += 1
        return c + 1
    def a(n):
        p = 2
        while True:
            d, p1, found = digits(p, n), n*p, True
            for f in range(n**(d+1), n**(d+2), n**(d+1)):
                for e in range(0, n, 2) if (f+p1)%2 else range(1, n, 2):
                    if isprime(f + p1 + e): found = False; break
                if not found: break
            if found: return p
            p = nextprime(p)
    print([a(n) for n in range(2, 15)]) # Michael S. Branicky, Sep 05 2022

Extensions

a(24)-a(26) added by James G. Merickel, Sep 22 2014
a(26) removed (see user talk page) by Bill McEachen, Sep 03 2022
a(26) from Michael S. Branicky, Sep 20 2022
a(27) from Michael S. Branicky, Jul 10 2023
a(28) from Michael S. Branicky, Jul 12 2023

A247593 Smallest prime not the middle of one 4 digits longer in base n.

Original entry on oeis.org

5, 1009, 764051, 7346914823
Offset: 2

Views

Author

James G. Merickel, Sep 20 2014

Keywords

Comments

a(n), n > 6, is intractable, and a(6) requires extensive resources: There are 360 candidate numbers for any candidate prime, all of which need to be composite, prefixing 30 2-digit numbers and suffixing the 12 ending in either 1 or 5. This compares with 400 for base 5, but in the base-6 case divisibility by 2 and 3 are already ruled out.

Examples

			In base 2--binary, decimal 2 and 3 have representations 10 and 11; and binary 101001 and 101111 represent decimal 41 and 47, so that a(2) > 3.  Binary 101--decimal 5--has the 4 binary candidates 1010101, 1010111, 1110101, and 1110111--decimal 85, 87, 117 and 119--requiring consideration for primality, but all are composite: a(2)=5.
		

Crossrefs

Programs

  • PARI
    ok(n,b)=my(D=b^#digits(n,b),b2=b^2);forstep(k=b^3*D+n*b2,b2*(b2-1)*D+n*b2,D*b2, if(nextprime(k)Charles R Greathouse IV, Sep 20 2014
Showing 1-2 of 2 results.