login

Year-end appeal: Please make a donation to the OEIS Foundation to support ongoing development and maintenance of the OEIS. We are now in our 61st year, we have over 378,000 sequences, and we’ve reached 11,000 citations (which often say “discovered thanks to the OEIS”).

A074830
Number of base reversals which result in a prime for bases less than n.
0
0, 0, 1, 0, 3, 2, 5, 2, 1, 3, 7, 3, 10, 4, 3, 3, 12, 4, 9, 5, 4, 7, 14, 4, 11, 5, 5, 7, 15, 3, 20, 9, 6, 6, 12, 3, 19, 11, 9, 6, 23, 4, 26, 8, 6, 10, 24, 7, 17, 11, 7, 15, 33, 4, 19, 9, 12, 12, 22, 5, 30, 16, 11, 13, 15, 4, 38, 15, 14, 8, 36, 5, 40, 17, 7, 13, 32, 4, 39, 13, 6, 13, 38, 4, 25
OFFSET
1,5
COMMENTS
If n is composite, then there does not exist any base greater than n whose base reversal is prime. And if n is a prime, then there exist an infinite number of bases greater than n whose base reversals are primes (hence this sequence's restriction to bases up to n only).
EXAMPLE
a(5) = 3 because 5 = 101_2 and its reversal 101_2 = 5, 5 = 12_3 and its reversal 21_3 = 7, 5 = 11_4 and its reversal 11_4 = 5. 3, 7, and 5 are all primes.
MATHEMATICA
a[n_] := Block[{c = 0, b = 2}, While[b < n + 1, If[ PrimeQ[ FromDigits[ Reverse[ IntegerDigits[n, b]], b]], c++ ]; b++ ]; c]; Table[ a[n], {n, 1, 85}]
PROG
(PARI) a(n) = sum(b=2, n-1, isprime(fromdigits(Vecrev(digits(n, b)), b))); \\ Michel Marcus, Apr 29 2021
CROSSREFS
Sequence in context: A093527 A088233 A056008 * A369043 A182983 A231146
KEYWORD
base,easy,nonn
AUTHOR
Robert G. Wilson v, Sep 09 2002
STATUS
approved