A072965 In prime factorization of n replace all matching twin prime pairs with 1, where (3,5)-matches are replaced before (5,7).
1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 1, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 2, 31, 32, 33, 34, 1, 36, 37, 38, 39, 40, 41, 42, 43, 44, 3, 46, 47, 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 58, 59, 4, 61, 62, 63, 64, 65, 66, 67, 68, 69, 2, 71, 72, 73, 74
Offset: 1
Examples
a(30)=a(2*3*5)=2*1=2; a(105)=a(3*5*7)=1*7=7; a(143)=a(11*13)=1; a(225)=a(3*3*5*5)=a((3*5)*(3*5))=1*1=1; a(525)=a(3*5*5*7)=a((3*5)*(5*7))=1*1=1.
Links
- Reinhard Zumkeller, Table of n, a(n) for n = 1..10000
Programs
-
Haskell
a072965 n = f 1 (a027746_row n) where f y [] = y f y [p] = p * y f y (2:ps) = f (2 * y) ps f y (3:5:_) = a072965 (n `div` 15) f y (p:qs@(q:ps)) | q == p + 2 = f y ps | otherwise = f (p * y) qs -- Reinhard Zumkeller, Oct 31 2012
-
Mathematica
a[n_] := Times @@ (Flatten[ (Table[#[[1]], {#[[2]]}] & ) /@ FactorInteger[n]] //. {p1___, p2_, p3_, p4___} /; p3 == p2 + 2 -> {p1, p4}); Table[a[n], {n, 1, 74}](* Jean-François Alcover, Nov 04 2011 *)
-
PARI
a(n)=my(f=factor(n),t);for(i=2,#f[,1],if(f[i-1,1]+2==f[i,1],t=min(f[i-1,2],f[i,2]);f[i-1,2]-=t;f[i,2]-=t));factorback(f) \\ Charles R Greathouse IV, Nov 04 2011
Comments