# [seqfan] Re: Q A139312 simple prime indicator function

Charles Greathouse charles.greathouse at case.edu
Thu Jun 16 00:20:25 CEST 2011

```The name, and the formula in the name, a(n)=If[
a(n)=prime(n)^2>=prime(n-1)*prime(n+1)
0, 1, 0, 1, 0, 1, 0, 0, 1, 0, 1, 1, 0, 0, 1, 1, 0, 1, 1, 0, 1, 0, 0,
1, 1, 0, 1, 0, 0, 1, ...

The comment suggests
a(n)=2*prime(n)!=prime(n-1)+prime(n+1)
1, 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0, 1, 1, 1, 1, 1, 1, 1, 1,
1, 1, 1, 1, 1, 1, 1, ...

The first Mathematica program suggests
a(n)=prime(n)^2<prime(n-1)*prime(n+1)
1, 0, 1, 0, 1, 0, 1, 1, 0, 1, 0, 0, 1, 1, 0, 0, 1, 0, 0, 1, 0, 1, 1,
0, 0, 1, 0, 1, 1, 0, ...

while the second is
a(n)=my(a=prime(n)-prime(n-1),b=prime(n+1)-prime(n));if(a-b, a*b/(b-a)>0, 0)
1, 0, 1, 0, 1, 0, 1, 1, 0, 1, 0, 0, 1, 1, 0, 0, 1, 0, 0, 1, 0, 1, 1,
0, 0, 1, 0, 1, 1, 0, ...

None of these match the terms given.  The third and fourth definitions
are equal assuming something like Andrica's conjecture.

Charles Greathouse
Analyst/Programmer
Case Western Reserve University

On Wed, Jun 15, 2011 at 5:41 PM, Richard Mathar
<mathar at strw.leidenuniv.nl> wrote:
>
> Can someone explain the terms in http://oeis.org/A139312 (uned) which
> appears to be some variant of sign(A056221(n)) by definition, or intended
> to be a characteristic function dividing A046869 by A068828 according
> to prime(n)^1-prime(n-1)*prime(n+1). This, at least, is what the formula says..
> the references to A028388 and A130903 are misleading, I suspect.
> My version, according to the formula, would start with offset 2, because the 2nd
> prime is the first element in the sequence to consider:
> 0,1,0,1,0,1,0,0,1,0,1,1,0,0,1,1,0,1,1,0,1,0,0,1,1,0,1
> And that does not match with the terms.
>
> Maple (and it may help to run the Mma provided in the sequence):
> for n from 2 to 100 do
>        p := ithprime(n) ;
>        q := nextprime(p) ;
>        r := prevprime(p) ;
>        p^2-q*r ; # A056221
>        if % >= 0 then # A068828
>                printf("%d,",1) ;
>        else
>                printf("%d,",0) ;
>        end if;
> end do:
>
>
>
> _______________________________________________
>
> Seqfan Mailing list - http://list.seqfan.eu/
>

```