login
Honaker primes: primes P(k) such that sum of digits of P(k) equals sum of digits of k.
31

%I #48 Dec 30 2023 23:45:30

%S 131,263,457,1039,1049,1091,1301,1361,1433,1571,1913,1933,2141,2221,

%T 2273,2441,2591,2663,2707,2719,2729,2803,3067,3137,3229,3433,3559,

%U 3631,4091,4153,4357,4397,4703,4723,4903,5009,5507,5701,5711,5741,5801,5843

%N Honaker primes: primes P(k) such that sum of digits of P(k) equals sum of digits of k.

%C A090431(A049084(a(n))) = 0.

%D Proposed by _G. L. Honaker, Jr._

%H Charles R Greathouse IV, <a href="/A033548/b033548.txt">Table of n, a(n) for n = 1..10000</a> (first 1000 terms from T. D. Noe)

%F a(n) = A000040(A033549(n)). - _R. J. Mathar_, Jul 07 2021

%e 131 is the 32nd prime and sum of digits of both is 5.

%p read("transforms") :

%p isA033548 := proc(n)

%p if isprime(n) and digsum(n) = digsum(numtheory[pi](n)) then

%p true ;

%p else

%p false;

%p end if;

%p end proc:

%p A033548 := proc(n)

%p local p, k;

%p if n = 1 then

%p 131;

%p else

%p p := nextprime(procname(n-1)) ;

%p while true do

%p if isA033548(p) then

%p return p;

%p end if;

%p p := nextprime(p) ;

%p end do:

%p end if;

%p end proc:

%p seq(A033548(n),n=1..40) ; # _R. J. Mathar_, Jul 07 2021

%t Prime[ Select[ Range[ 2000 ], Apply[ Plus, IntegerDigits[ # ] ] == Apply[ Plus, IntegerDigits[ Prime[ # ] ] ] & ] ] (* _Santi Spadaro_, Oct 14 2001 *)

%t Select[ Prime@ Range@ 5927, Plus @@ IntegerDigits@ # == Plus @@ IntegerDigits@ PrimePi@ # &] (* _Robert G. Wilson v_, Jun 07 2009 *)

%t nn=800;Transpose[Select[Thread[{Prime[Range[nn]],Range[nn]}],Total[IntegerDigits[First[#]]]== Total[ IntegerDigits[ Last[#]]]&]][[1]] (* _Harvey P. Dale_, Jun 13 2011 *)

%o (Haskell)

%o a033548 n = a033548_list !! (n-1)

%o a033548_list = filter ((== 0) . a090431 . a049084) a000040_list

%o -- _Reinhard Zumkeller_, Mar 16 2014

%o (PARI) is(n)=isprime(n) && sumdigits(n)==sumdigits(primepi(n)) \\ _Charles R Greathouse IV_, Jun 18 2015

%o (Python)

%o from sympy.ntheory.factor_ import digits

%o from sympy import primepi, primerange

%o print([n for n in primerange(1, 5901) if (sum(digits(n)[1:])==sum(digits(primepi(n))[1:]))]) # _Indranil Ghosh_, Jun 27 2017, after _Charles R Greathouse IV_

%Y Cf. A007605, A033549, A049084, A072439, A090431.

%K nonn,base,nice

%O 1,1

%A Calculated by _Jud McCranie_

%E More terms from _Robert G. Wilson v_, Jun 07 2009