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.

A123317 Smallest prime power m such that n+m is a prime number.

This page as a plain text file.
%I A123317 #5 Aug 09 2019 05:02:39
%S A123317 1,1,2,1,2,1,4,3,2,1,2,1,4,3,2,1,2,1,4,3,2,1,8,5,4,3,2,1,2,1,16,5,4,3,
%T A123317 2,1,4,3,2,1,2,1,4,3,2,1,32,5,4,3,2,1,8,5,4,3,2,1,2,1,256,5,4,3,2,1,4,
%U A123317 3,2,1,2,1,16,5,4,3,2,1,4,3,2,1,128,5,4,3,2,1,8,7,16,5,4,3,2,1,4,3,2,1,2,1
%N A123317 Smallest prime power m such that n+m is a prime number.
%F A123317 A123318(n) = n + a(n);
%F A123317 a(A006093(n)) = 1; a(A040976(n)) = 2 for n>2.
%e A123317 n=23: 23+1=3*2^3, 23+2=5^2, 23+3=13*2, 23+2^2=3^3, 23+5=7*2^2, 23+7=5*3*2, but 23+8=31=A000040(11), therefore a(23)=8;
%e A123317 n=24: 24+1=5^2, 24+2=13*2, 24+3=3^3, 24+2^2=7*2^2, but 24+5=29=A000040(10), therefore a(24)=5;
%e A123317 the smallest occurring proper odd prime power is 9=3^2:
%e A123317 n=118: 118+1=17*7, 118+2=5*3*2^3, 118+3=11^2, 118+2^2=61*2, 118+5=41*3, 118+7=5^3, 118+2^3=7*2*3^2, but 118+3^2=127=A000040(31), therefore a(118)=9.
%p A123317 A123317 := proc(n)
%p A123317     local m ;
%p A123317     m :=1 ;
%p A123317     if isprime(n+m) then
%p A123317         return m ;
%p A123317     end if;
%p A123317     for m from 2 do
%p A123317         if nops(numtheory[factorset](m)) = 1 then
%p A123317             if isprime(n+m) then
%p A123317                 return m;
%p A123317             end if;
%p A123317         end if;
%p A123317     end do:
%p A123317 end proc:
%p A123317 seq(A123317(n),n=1..102) ; # _R. J. Mathar_, Aug 09 2019
%Y A123317 Cf. A013632, A000961.
%K A123317 nonn
%O A123317 1,3
%A A123317 _Reinhard Zumkeller_, Sep 27 2006