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.

A384211 a(n) is the number of distinct ways of representing n in any integer base >= 2 using only prime digits.

This page as a plain text file.
%I A384211 #12 May 30 2025 18:11:10
%S A384211 0,0,1,1,0,1,0,1,1,0,1,2,1,2,2,2,1,4,2,3,2,3,1,6,2,3,4,4,1,6,2,5,4,5,
%T A384211 2,7,2,7,4,5,3,8,4,9,3,7,3,12,3,6,5,6,4,11,2,9,4,9,6,13,3,11,8,12,3,
%U A384211 12,3,13,7,8,5,14,5,13,5,11,4,15,3,13,8,10,7,15
%N A384211 a(n) is the number of distinct ways of representing n in any integer base >= 2 using only prime digits.
%C A384211 The representations of n remain the same for bases greater than n, as they all consist solely of the digit n.
%H A384211 Felix Huber, <a href="/A384211/b384211.txt">Table of n, a(n) for n = 0..10000</a>
%e A384211 The a(43) = 9 representations of [4,3] in base 10 using only prime digits are [2,2,3] in base 4, [5,3] in base 8, [3,7] in base 12, [2,13] in base 15, [2,11] in base 16, [2,7] in base 18, [2,5] in base 19, [2,3] in base 20 and [43] in bases >= 44.
%p A384211 A384211:=proc(n)
%p A384211     local a,b,c;
%p A384211     a:=0;
%p A384211     for b from 2 to n+1 do
%p A384211         c:=convert(n,'base',b);
%p A384211         if select(isprime,c)=c then
%p A384211             a:=a+1
%p A384211         fi
%p A384211     od;
%p A384211     return a
%p A384211 end proc;
%p A384211 seq(A384211(n),n=0..87);
%p A384211 A384211representations:=proc(n)
%p A384211     local L,b,c;
%p A384211     L:=[];
%p A384211     for b from 2 to n+1 do
%p A384211         c:=convert(n,'base',b);
%p A384211         if select(isprime,c)=c then
%p A384211             L:=[op(L),b,ListTools:-Reverse(c)]
%p A384211         fi
%p A384211     od;
%p A384211     return op(L)
%p A384211 end proc;
%p A384211 A384211representations(43);
%t A384211 a[n_] := Boole[PrimeQ[n]] + Count[Range[2, n-1], _?(AllTrue[IntegerDigits[n, #], PrimeQ] &)]; Array[a, 100 ,0] (* _Amiram Eldar_, May 23 2025 *)
%o A384211 (Python)
%o A384211 from sympy import isprime
%o A384211 from sympy.ntheory import digits
%o A384211 def a(n): return len(set(t for b in range(2, n+2) if all(map(isprime, (t:=tuple(digits(n, b)[1:]))))))
%o A384211 print([a(n) for n in range(84)]) # _Michael S. Branicky_, May 23 2025
%o A384211 (PARI) a(n) = sum(k=2, n+1, my(d=digits(n, k)); #select(isprime, d) == #d); \\ _Michel Marcus_, May 26 2025
%Y A384211 Cf. A055240, A355034.
%K A384211 nonn,base
%O A384211 0,12
%A A384211 _Felix Huber_, May 23 2025