A248909 Completely multiplicative with a(p) = p if p = 6k+1 and a(p) = 1 otherwise.
1, 1, 1, 1, 1, 1, 7, 1, 1, 1, 1, 1, 13, 7, 1, 1, 1, 1, 19, 1, 7, 1, 1, 1, 1, 13, 1, 7, 1, 1, 31, 1, 1, 1, 7, 1, 37, 19, 13, 1, 1, 7, 43, 1, 1, 1, 1, 1, 49, 1, 1, 13, 1, 1, 1, 7, 19, 1, 1, 1, 61, 31, 7, 1, 13, 1, 67, 1, 1, 7, 1, 1, 73, 37, 1, 19, 7, 13, 79, 1, 1
Offset: 1
Examples
a(49) = 49 because 49 = 7^2 and 7 = 6*1 + 1. a(15) = 1 because 15 = 3*5 and neither of these primes is of the form 6k+1. a(62) = 31 because 62 = 31*2, 31 = 6*5 + 1, and 2 is not of the form 6k+1.
Links
Crossrefs
Programs
-
Maple
A248909 := proc(n) local a,pf; a := 1 ; for pf in ifactors(n)[2] do if modp(op(1,pf),6) = 1 then a := a*op(1,pf)^op(2,pf) ; end if; end do: a ; end proc: # R. J. Mathar, Mar 14 2015
-
Mathematica
f[p_, e_] := If[Mod[p, 6] == 1, p^e, 1]; a[1] = 1; a[n_] := Times @@ f @@@ FactorInteger[n]; Array[a, 100] (* Amiram Eldar, Sep 19 2020 *)
-
PARI
a(n) = {my(f = factor(n)); for (i=1, #f~, if ((f[i,1] - 1) % 6, f[i, 1] = 1);); factorback(f);} \\ Michel Marcus, Mar 11 2015
-
Python
from sympy import factorint def A248909(n): y = 1 for p,e in factorint(n).items(): y *= (1 if (p-1) % 6 else p)**e return y # Chai Wah Wu, Mar 15 2015
-
Sage
n=100; sixnplus1Primes=[x for x in primes_first_n(100) if (x-1)%6==0] [prod([(x^(x in sixnplus1Primes))^y for x,y in factor(n)]) for n in [1..n]]
-
Scheme
(define (A248909 n) (if (= 1 n) n (* (if (= 1 (modulo (A020639 n) 6)) (A020639 n) 1) (A248909 (A032742 n))))) ;; Antti Karttunen, Jul 09 2017
Formula
a(1) = 1; for n > 1, if A020639(n) = 1 (mod 6), a(n) = A020639(n) * a(A032742(n)), otherwise a(n) = a(A028234(n)). - Antti Karttunen, Jul 09 2017
a(n) = a(A065330(n)). - Peter Munn, Mar 06 2021
Comments