login
A112049
a(n) = position of A112046(n) in A000040.
17
1, 1, 2, 2, 1, 1, 2, 2, 1, 1, 3, 3, 1, 1, 2, 2, 1, 1, 2, 2, 1, 1, 3, 4, 1, 1, 2, 2, 1, 1, 2, 2, 1, 1, 4, 3, 1, 1, 2, 2, 1, 1, 2, 2, 1, 1, 3, 3, 1, 1, 2, 2, 1, 1, 2, 2, 1, 1, 4, 5, 1, 1, 2, 2, 1, 1, 2, 2, 1, 1, 3, 3, 1, 1, 2, 2, 1, 1, 2, 2, 1, 1, 3, 6, 1, 1, 2, 2, 1, 1, 2, 2, 1, 1, 4, 3, 1, 1, 2, 2, 1, 1
OFFSET
1,3
COMMENTS
A112051 gives the first positions of distinct new values in this sequence, that seem also to be the positions of the first occurrence of each n, and thus the positions of the records. Compare also to A084921. - Antti Karttunen, May 26 2017
LINKS
Indranil Ghosh (terms 1..1000) & Antti Karttunen, Table of n, a(n) for n = 1..32768
FORMULA
a(n) = A049084(A112046(n)).
MATHEMATICA
a112046[n_]:=Block[{i=1}, While[JacobiSymbol[i, 2n + 1]==1, i++]; i]; a049084[n_]:=If[PrimeQ[n], PrimePi[n], 0]; Table[a049084[a112046[n]], {n, 102}] (* Indranil Ghosh, May 11 2017 *)
PROG
(PARI) A112049(n) = for(i=1, (2*n), if((kronecker(i, (n+n+1)) < 1), return(primepi(i)))); \\ Antti Karttunen, May 26 2017
(Python)
from sympy import jacobi_symbol as J, isprime, primepi
def a049084(n):
return primepi(n) if isprime(n) else 0
def a112046(n):
i=1
while True:
if J(i, 2*n + 1)!=1: return i
else: i+=1
def a(n): return a049084(a112046(n))
print([a(n) for n in range(1, 103)]) # Indranil Ghosh, May 11 2017
CROSSREFS
Cf. A286579 (ordinal transform).
Sequence in context: A293681 A293773 A071017 * A055230 A290262 A112050
KEYWORD
nonn
AUTHOR
Antti Karttunen, Aug 27 2005
EXTENSIONS
Unnecessary fallback-clause removed from the name by Antti Karttunen, May 26 2017
STATUS
approved