login

Reminder: The OEIS is hiring a new managing editor, and the application deadline is January 26.

Primes p such that each of the decimal numbers p^k for k=1..5 has exactly two 1s.
2

%I #16 Mar 23 2024 20:18:37

%S 1217,14591,20611,21481,41941,60161,81371,110533,112223,115099,115237,

%T 117053,124133,131939,135841,140551,144139,159013,170123,176819,

%U 195731,218521,241051,246511,301241,421241,461561,513001,517261,614143,627511,716819,786151,810149

%N Primes p such that each of the decimal numbers p^k for k=1..5 has exactly two 1s.

%C Number of terms < 10^n: 0, 0, 0, 1, 7, 38, 266, ..., . - _Robert G. Wilson v_, Nov 05 2010

%e 1217^k with k=1..5: 1217, 1481089, 1802485313, 2193624625921, 2669641169745857.

%t fQ[n_] := DigitCount[{n, n^2, n^3, n^4, n^5}, 10, 1] == {2, 2, 2, 2, 2}; Select[ Prime@ Range@ 57800, fQ] (* _Robert G. Wilson v_, Nov 05 2010 *)

%t Select[Prime[Range[52000]],Union[DigitCount[#^Range[5],10,1]]=={2}&] (* _Harvey P. Dale_, Feb 18 2015 *)

%o (Python)

%o from somewhere import primegen

%o for p in primegen():

%o if all(str(p**k).count('1') == 2 for k in range(1, 6)):

%o print(p) # _Lucas A. Brown_, Mar 23 2024

%K base,nonn

%O 1,1

%A _Zak Seidov_, Oct 31 2010

%E More terms from _Robert G. Wilson v_, Nov 05 2010

%E a(32)-a(34) from _Lucas A. Brown_, Mar 23 2024

%E Definition clarified by _N. J. A. Sloane_, Mar 23 2024