A292374 a(1) = 1, a(2n) = 0, and for odd numbers n > 1, a(n) = a(A064989(n)) + [n == 1 (mod 4)].
1, 0, 0, 0, 1, 0, 1, 0, 1, 0, 1, 0, 2, 0, 0, 0, 3, 0, 3, 0, 1, 0, 3, 0, 2, 0, 0, 0, 4, 0, 4, 0, 1, 0, 0, 0, 5, 0, 0, 0, 6, 0, 6, 0, 1, 0, 6, 0, 3, 0, 0, 0, 7, 0, 1, 0, 1, 0, 7, 0, 8, 0, 0, 0, 2, 0, 8, 0, 1, 0, 8, 0, 9, 0, 0, 0, 1, 0, 9, 0, 1, 0, 9, 0, 1, 0, 0, 0, 10, 0, 1, 0, 1, 0, 0, 0, 11, 0, 0, 0, 12, 0, 12, 0, 1
Offset: 1
Keywords
Links
Crossrefs
Programs
-
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 *)
-
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)}; A292374(n) = if(1==n,n,if(!(n%2),0,(if(1==(n%4),1,0)+A292374(A064989(n)))));
-
Scheme
;; With memoization-macro definec. (definec (A292374 n) (cond ((even? n) 0) ((= 1 n) 1) (else (+ (if (= 1 (modulo n 4)) 1 0) (A292374 (A064989 n))))))
Comments