Year-end appeal: Please make a donation to the OEIS Foundation to support ongoing development and maintenance of the OEIS. We are now in our 61st year, we have over 378,000 sequences, and we’ve reached 11,000 citations (which often say “discovered thanks to the OEIS”).
%I #27 Jun 12 2023 09:31:37
%S 2,2,3,2,23,73,15,2,3,5,13,57,3,171,5,2,21,7,55,8902,26,1298,115,139,
%T 3,2019,3,4,3,15,56,177
%N Smallest number k such that the numerator of the generalized harmonic number H(k,n) = Sum_{i=1..k} 1/i^n is a prime.
%C a(n) = 2 for n = {1,2,4,8,16,...}. Corresponding Fermat primes A019434.
%C a(n) = 3 for n = {3,9,13,25,27,29,95,107,153,159,...}.
%C a(n) = 5 for n = {10,15,60,90,197,209,...}.
%C a(n) = 7 for n = {18,47,112,155,273,...}.
%C a(n) = 15 for n = {7,30,43,...}.
%C a(21) = 26. a(28) = 4. a(31) = 56. a(144) = 9.
%C From _Alexander Adamchuk_, Apr 18 2010: (Start)
%C a(22)-a(25) = {1298,115,139,3}.
%C a(27)-a(32) = {3,4,3,15,56,177}.
%C a(n) = 3 for all n>2 listed in A125706. (End)
%C a(26) = 2019. - _Alexander Adamchuk_, Apr 26 2010
%C a(20) > 3000. - _Michael S. Branicky_, Jun 25 2022
%H Eric Weisstein's World of Mathematics, <a href="http://mathworld.wolfram.com/HarmonicNumber.html">Harmonic Number</a>
%t Do[n = 1; f = 0; While[Not[PrimeQ[Numerator[f]]], f = f + 1/n^x; n++ ]; Print[{x, n - 1}], {x, 1, 25}] (* _Alexander Adamchuk_, Apr 18 2010 *)
%o (PARI) a(n) = my(k=1); while (!ispseudoprime(numerator(sum(i=1, k, 1/i^n))), k++); k; \\ _Michel Marcus_, Jun 04 2022
%o (Python)
%o from sympy import isprime
%o from fractions import Fraction
%o def a(n):
%o Hkn, k = Fraction(1, 1), 1
%o while not isprime(Hkn.numerator):
%o k += 1
%o Hkn += Fraction(1, k**n)
%o return k
%o print([a(n) for n in range(1, 20)]) # _Michael S. Branicky_, Jun 11 2022
%Y Cf. A001008, A007406, A007408, A007410, A099828, A019434, A125706.
%K nonn,hard,more
%O 1,1
%A _Alexander Adamchuk_, Dec 28 2006, Jan 31 2007
%E a(22)-a(25) from _Alexander Adamchuk_, Apr 18 2010
%E a(26)-a(32) from _Alexander Adamchuk_, Apr 26 2010
%E Incorrect a(20) removed by _Michael S. Branicky_, Jun 25 2022
%E a(20) = 8902 from _Michael S. Branicky_, Jun 12 2023