login
Numbers n such that n-1 and n+1 have the same number of prime factors as n (with multiplicity).
2

%I #19 Nov 30 2016 13:11:39

%S 34,86,94,122,142,171,202,214,218,245,285,302,394,429,435,446,507,603,

%T 604,605,634,638,698,842,922,963,1042,1075,1084,1085,1131,1138,1245,

%U 1262,1275,1310,1346,1402,1413,1431,1435,1449,1491,1533,1557,1587,1605,1635,1642,1676,1762,1772,1838,1886,1894,1925,1942

%N Numbers n such that n-1 and n+1 have the same number of prime factors as n (with multiplicity).

%H Ely Golden, <a href="/A278311/b278311.txt">Table of n, a(n) for n = 1..10000</a>

%e a(1) = 34, as 33, 34, and 35 all have 2 prime factors.

%e a(2) = 86, as 85, 86, and 87 all have 2 prime factors.

%o (Java) public class A278311{

%o public static void main(String[] args)throws Exception{

%o long dim0=numberOfPrimeFactors(2);//note that this method must be manually implemented by the user

%o long dim1=numberOfPrimeFactors(3);

%o long dim2;

%o long counter=4;

%o long index=1;

%o while(index<=10000){

%o dim2=numberOfPrimeFactors(counter);

%o if(dim2==dim1&&dim1==dim0){System.out.println(index+" "+(counter-1));index++;}

%o dim0=dim1;

%o dim1=dim2;

%o counter++;

%o }

%o }

%o }

%o (SageMath)

%o def bigomega(x):

%o s=0;

%o f=list(factor(x));

%o for c in range(len(f)):

%o s+=f[c][1]

%o return s;

%o dim0=bigomega(2);

%o dim1=bigomega(3);

%o counter=4

%o index=1

%o while(index<=10000):

%o dim2=bigomega(counter);

%o if(dim2==dim1&dim1==dim0):

%o print(str(index)+" "+str(counter-1))

%o index+=1;

%o dim0=dim1;

%o dim1=dim2;

%o counter+=1;

%o (PARI) isok(n) = (bigomega(n-1) == bigomega(n)) && (bigomega(n) == bigomega(n+1)); \\ _Michel Marcus_, Nov 17 2016

%Y Intersection of A045920 and A278291.

%Y a(n) = A045939(n) + 1.

%K nonn

%O 1,1

%A _Ely Golden_, Nov 17 2016