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.

A386929 a(n) is the least base b in {2,...,10} such that the base-b expansion of n, when read as a decimal integer, is prime; a(n) = 0 if no such base exists.

Original entry on oeis.org

0, 3, 2, 3, 2, 5, 4, 5, 6, 3, 4, 9, 4, 0, 6, 5, 4, 0, 4, 0, 5, 3, 2, 0, 6, 5, 6, 5, 4, 0, 7, 0, 5, 3, 8, 0, 4, 7, 6, 0, 5, 0, 4, 0, 6, 3, 2, 9, 8, 7, 0, 7, 4, 0, 4, 5, 8, 3, 7, 0, 4, 0, 5, 9, 8, 9, 3, 5, 0, 0, 4, 0, 4, 0, 8, 0, 4, 0, 3, 0, 5, 9, 4, 9, 7, 0, 6, 9, 2, 0, 4, 0, 6, 3, 8
Offset: 1

Views

Author

Keywords

Comments

There are infinitely many zeros since if n is a multiple of 2520, then each base-b expansion ends with digit 0.

Examples

			a(10) = 3 since 10 in base 3 is "101" and 101 is prime; base 2 is "1010" -> 1010 composite.
a(11) = 4 since base 4 gives "23" -> 23 is prime; base 2 "1011" -> 1011 composite; base 3 "102" -> 102 composite.
a(23) = 2 since base 2 gives "10111" -> 10111 is prime.
		

Crossrefs

Cf. A038537, A052026 (the zeros), A052033 (the tens).

Programs

  • Mathematica
    a[n_] := Block[{m}, Do[m = FromDigits[IntegerDigits[n, b], 10]; If[PrimeQ[m], Return[b]], {b, 2, 10}]; 0]
  • PARI
    a(n) = for(b=2, 10, if (isprime(fromdigits(digits(n, b))), return(b))); \\ Michel Marcus, Aug 09 2025

Formula

a(2520*n) = 0.