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.

A282432 Number of primes of the form n - 3^k.

This page as a plain text file.
%I A282432 #22 Sep 08 2022 08:46:18
%S A282432 0,0,1,1,1,2,0,2,0,1,1,2,0,3,0,2,0,1,0,3,0,2,0,1,0,2,0,1,1,2,0,4,0,2,
%T A282432 0,0,0,3,0,3,0,1,0,3,0,3,0,1,0,3,0,1,0,1,0,3,0,1,0,1,0,3,0,2,0,0,0,3,
%U A282432 0,3,0,1,0,3,0,2,0,0,0,3,0,2,1,2,0,3,0,3,0,1,0,3,0,2,0,0,0,4,0,3,0,1,0,3,0
%N A282432 Number of primes of the form n - 3^k.
%F A282432 a(A282430(n)) = 0.
%F A282432 G.f.: ( Sum_{i>=0} x^(3^i) ) * ( Sum_{j>=1} x^prime(j) ). - _Ilya Gutkovskiy_, Feb 10 2022
%e A282432 a(14) = 3; 14 - 3^0 = 13, 14 - 3 = 11, 14 - 3^2 = 5, three primes.
%p A282432 A282432 := proc(n)
%p A282432     a := 0 ;
%p A282432     for k from 0 do
%p A282432         if n-3^k < 2 then
%p A282432             return a ;
%p A282432         elif isprime(n-3^k) then
%p A282432             a := a+1 ;
%p A282432         end if;
%p A282432     end do:
%p A282432 end proc:
%p A282432 seq(A282432(n),n=1..80) ; # _R. J. Mathar_, Mar 07 2022
%o A282432 (Magma) lst:=[]; for n in [1..105] do c:=0; e:=Floor(Log(3, n)); k:=0; while k le e do p:=n-3^k; if IsPrime(p) then c+:=1; end if; k+:=1; end while; Append(~lst, c); end for; lst;
%o A282432 (PARI) ispp3(n) = (n==1) || (n==3) || (ispower(n,,&p) && (p==3));
%o A282432 a(n) = {my(nb = 0); forprime(p=2, n, nb += ispp3(n-p);); nb;} \\ _Michel Marcus_, Feb 18 2017
%Y A282432 Cf. A109925, A282430.
%K A282432 nonn,easy
%O A282432 1,6
%A A282432 _Arkadiusz Wesolowski_, Feb 15 2017