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.

A140959 Number of distinct-digit primes in base n.

This page as a plain text file.
%I A140959 #20 Dec 25 2021 14:30:12
%S A140959 0,1,6,6,31,130,632,4418,34401,283086,2586883,28637741,336810311
%N A140959 Number of distinct-digit primes in base n.
%e A140959 a(1) = 0; a(2) = 1 since only the prime 2 in base 2 has distinct integers, 10_2;
%e A140959 a(3) = 6 since the primes {2, 3, 5, 7, 11 & 19} in base 3 have distinct integers, {2_3, 10_3, 12_3, 21_3, 102_3, 201_3}; etc.
%e A140959 a(10) = 283086 because it is the partial sum of A073532.
%t A140959 f[b_] := Block[{c = 0, k = 1, lmt = b^b}, While[p = Prime@ k; p < lmt, k++; If[ Union[ Length /@ Split@ Sort@ IntegerDigits[p, b]] == {1}, c++ ]]; c]; Array[f, 6]
%o A140959 (Sage)
%o A140959 def a(n):
%o A140959     return sum(len(p.digits(n)) == len(set(p.digits(n))) for p in prime_range(n^n)) # _Eric M. Schmidt_, Oct 26 2014
%o A140959 (Python)
%o A140959 from sympy import isprime
%o A140959 from itertools import permutations
%o A140959 def a(n):
%o A140959     digs = "".join(str(i) for i in range(min(10, n)))
%o A140959     if n > 10: digs += "".join(chr(ord("A")+i) for i in range(n-10))
%o A140959     return sum(1 for i in range(1, n+1) for p in permutations(digs, i) if p[0] != '0' and isprime(int("".join(p), n)) )
%o A140959 print([a(n) for n in range(1, 10)]) # _Michael S. Branicky_, Dec 25 2021
%Y A140959 Cf. A073532.
%K A140959 nonn,base,hard,more
%O A140959 1,3
%A A140959 _Robert G. Wilson v_, Jul 25 2008
%E A140959 a(11)-a(12) from _Eric M. Schmidt_, Oct 29 2014
%E A140959 a(13) from _Michael S. Branicky_, Dec 25 2021