login
Hamming distance between prime(n) and prime(n+1) in base 10.
3

%I #11 Jul 09 2021 23:57:39

%S 1,1,1,2,1,1,1,2,1,2,1,2,1,1,2,1,2,1,2,1,1,2,1,2,3,1,1,1,2,2,2,1,1,1,

%T 2,1,2,1,2,1,2,1,1,1,1,3,2,1,1,2,1,2,1,1,2,1,2,1,2,1,1,3,2,1,1,2,1,1,

%U 1,2,1,2,2,1,2,1,2,3,1,1,2,1,1,1

%N Hamming distance between prime(n) and prime(n+1) in base 10.

%H Hugo Pfoertner, <a href="/A345985/b345985.txt">Table of n, a(n) for n = 1..10000</a>

%e Prime(4) = 7, prime(5) = 11, the words 7 and 11 are at Hamming distance 2 apart, so a(4) = 2.

%o (PARI) \\ abs Hamming distance in decimal digits

%o dhd(j,k)={my(dj=digits(j),dk=digits(k),s=0);s=abs(#dj-#dk);for(i=1,min(#dj,#dk),s+=(dj[i]!=dk[i]));s};

%o a345985(limit)={my(pp=2);forprime(p=3,limit,print1(dhd(p,pp),", ");pp=p)};

%o a345985(prime(85)) \\ _Hugo Pfoertner_, Jul 09 2021

%Y Cf. A205510.

%K nonn,base,easy

%O 1,4

%A _N. J. A. Sloane_, Jul 09 2021