OFFSET
1,13
COMMENTS
For odd numbers > 1, iterate the map x -> A064989(x), which shifts every prime in the prime factorization of n one index step towards smaller primes. a(n) counts the numbers of the form 4k+1 encountered until the first number which is even has been reached. This count includes also n itself if it is of the form 4k+1 (A016813), thus a(1) = 1.
In other words, locate the position where n is in square array A246278 and moving up by that column, count all numbers of the form 4k+1 until an even number at the top of the column is reached.
LINKS
FORMULA
MATHEMATICA
a[1] = 1; a[n_] := a[n] = If[EvenQ@ n, 0, a[Times @@ Power[Which[# == 1, 1, # == 2, 1, True, NextPrime[#, -1]] & /@ First@ #, Last@ #] &@ Transpose@ FactorInteger@ n] + Boole[Mod[n, 4] == 1]]; Array[a, 105] (* Michael De Vlieger, Sep 17 2017 *)
PROG
(PARI)
A064989(n) = {my(f); f = factor(n); if((n>1 && f[1, 1]==2), f[1, 2] = 0); for (i=1, #f~, f[i, 1] = precprime(f[i, 1]-1)); factorback(f)};
(Scheme, with memoization-macro definec)
CROSSREFS
KEYWORD
nonn
AUTHOR
Antti Karttunen, Sep 17 2017
STATUS
approved