A073781 Number of 2's in base-3 representation of n-th prime.
1, 0, 1, 1, 1, 0, 2, 1, 2, 1, 0, 0, 1, 1, 2, 3, 2, 2, 1, 3, 2, 3, 1, 2, 1, 2, 1, 3, 0, 1, 1, 2, 2, 1, 2, 2, 2, 1, 2, 2, 3, 2, 2, 1, 3, 1, 2, 3, 3, 2, 4, 4, 4, 2, 1, 2, 3, 0, 1, 1, 0, 2, 1, 2, 2, 3, 1, 0, 2, 2, 1, 2, 1, 1, 1, 2, 2, 2, 3, 1, 2, 2, 4, 1, 2, 2, 3, 3
Offset: 1
Examples
a(7)=2 as 7th prime 17 is 122 in base-3 representation.
Links
- Harvey P. Dale, Table of n, a(n) for n = 1..1000
Programs
-
Mathematica
a2[n_] := Length[Cases[IntegerDigits[Prime[n], 3], 2]] DigitCount[Prime[Range[90]],3,2] (* Harvey P. Dale, May 11 2016 *)