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.

Original entry on oeis.org

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, 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, 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
Offset: 1

Views

Author

Arkadiusz Wesolowski, Feb 15 2017

Keywords

Examples

			a(14) = 3; 14 - 3^0 = 13, 14 - 3 = 11, 14 - 3^2 = 5, three primes.
		

Crossrefs

Programs

  • 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;
    
  • Maple
    A282432 := proc(n)
        a := 0 ;
        for k from 0 do
            if n-3^k < 2 then
                return a ;
            elif isprime(n-3^k) then
                a := a+1 ;
            end if;
        end do:
    end proc:
    seq(A282432(n),n=1..80) ; # R. J. Mathar, Mar 07 2022
  • PARI
    ispp3(n) = (n==1) || (n==3) || (ispower(n,,&p) && (p==3));
    a(n) = {my(nb = 0); forprime(p=2, n, nb += ispp3(n-p);); nb;} \\ Michel Marcus, Feb 18 2017

Formula

a(A282430(n)) = 0.
G.f.: ( Sum_{i>=0} x^(3^i) ) * ( Sum_{j>=1} x^prime(j) ). - Ilya Gutkovskiy, Feb 10 2022