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.

A385280 a(n) is the number of n-digit primes of which all digits except one are the same.

Original entry on oeis.org

4, 20, 46, 43, 40, 53, 35, 49, 40, 38, 44, 52, 35, 45, 49, 42, 38, 57, 27, 45, 38, 47, 37, 52, 33, 45, 56, 38, 36, 65, 29, 56, 48, 40, 38, 58, 37, 33, 57, 40, 37, 61, 41, 39, 37, 44, 36, 55, 47, 43, 47, 43, 35, 62, 43, 46, 29, 35, 37, 56, 39, 41, 46, 48, 39, 74, 45, 34, 34, 35, 34, 67, 39, 45, 43
Offset: 1

Views

Author

Robert Israel, Jun 24 2025

Keywords

Comments

a(n) is the number of n-digit primes obtained by changing one digit of an n-digit repdigit.

Examples

			a(5) = 40 because there are 40 5-digit primes of which all digits but one are the same, namely 10111, 11113, 11117, 11119, 11131, 11161, 11171, 11311, 11411, 16111, 22229, 23333, 31333, 33331, 33343, 33353, 33533, 38333, 44449, 47777, 49999, 59999, 67777, 71777, 76777, 77377, 77477, 77747, 77773, 77797, 77977, 79777, 79999, 88883, 94999, 97777, 98999, 99929, 99989, 99991.
		

Crossrefs

Essentially the same as A258915.

Programs

  • Maple
    f:= proc(n)
         local i,j,m, m2, t;
         t:= 0;
         for i from 1 to 9 do
           for j in {$0..9} minus {i} do
              if (n-1)*i + j mod 3 = 0 then next fi;
              if j = 0 then m2:= n-2 else m2:= n-1 fi;
              if not member(i,{1,3,7,9}) then m2:= 0 fi;
              t:= t + nops(select( isprime,{seq((10^n-1)/9*i + 10^m*(j-i),m=0..m2)}))
         od od;
         t
    end proc:
    f(1):= 4: f(2):= 20:
    map(f, [$1..100]);
  • Python
    from gmpy2 import is_prime, digits
    def a(n):
        Rn = (10**n-1)//9
        return len(set(t for d in range(1, 10) for i in range(n if d in {1, 3, 7, 9} else 1) for c in set(range(-d, 10-d))-{0} if len(digits(t:=d*Rn+c*10**i))==n and is_prime(t)))
    print([a(n) for n in range(1, 76)]) # Michael S. Branicky, Jun 25 2025
Showing 1-1 of 1 results.