cp's OEIS Frontend

This is a front-end for the Online Encyclopedia of Integer Sequences, made by Christian Perfect. The idea is to provide OEIS entries in non-ancient HTML, and then to think about how they're presented visually. The source code is on GitHub.

A346064 Number of primes that may be generated by changing any two digits of n simultaneously.

This page as a plain text file.
%I A346064 #22 Aug 17 2021 19:24:45
%S A346064 21,17,20,15,21,20,21,16,21,17,23,18,22,17,23,22,23,17,23,19,23,19,22,
%T A346064 16,23,22,23,18,23,18,22,18,21,16,22,21,22,17,22,17,23,18,22,17,23,22,
%U A346064 23,17,23,19,23,19,22,16,23,22,23,18,23,18,22,18,21,16,22
%N A346064 Number of primes that may be generated by changing any two digits of n simultaneously.
%C A346064 Indices of low records are given by A345289. By heuristic considerations it is conjectured that a(n) > 0 for all n >= 10.
%H A346064 M. Filaseta, M. Kozek, Ch. Nicol and J. Selfridge, <a href="https://people.math.sc.edu/filaseta/papers/FKNSpaper0808.pdf">Composites that Remain Composite After Changing a Digit</a>, J. Comb. Number Theory, Vol. 2, No. 1 (2010), pp. 25-36.
%e A346064 Changing two digits of the number 17 simultaneously yields the primes 02,03,05,23,29,31,41,43,53,59,61,71,73,79,83,89, so a(17) = 16.
%p A346064 A346064 := proc(n)
%p A346064 local a, d, e, r, s, l, N, NN, nn, i;
%p A346064 a := 0;
%p A346064 N := convert(n, base, 10);
%p A346064 l := nops(N);
%p A346064 for d to l - 1 do
%p A346064    for e from d + 1 to l do
%p A346064       for r from 0 to 9 do
%p A346064          for s from 0 to 9 do
%p A346064         if r <> op(d, N) and s <> op(e, N) then
%p A346064            NN := subsop(d = r, e = s, N);
%p A346064            nn := add(op(i, NN)*10^(i - 1), i = 1 .. l);
%p A346064            if isprime(nn) then a := a + 1; end if;
%p A346064         end if;
%p A346064         end do;
%p A346064       end do;
%p A346064    end do;
%p A346064 end do;
%p A346064 a;
%p A346064 end proc:
%t A346064 Table[Count[Flatten[FromDigits/@Tuples[ReplacePart[t=List/@IntegerDigits[n],{#->Complement[Range[0,9],t[[#]]],#2->Complement[Range[0,9],t[[#2]]]}]&@@#]&/@Subsets[Range@IntegerLength@n,{2}]],_?PrimeQ],{n,10,100}] (* _Giorgos Kalogeropoulos_, Jul 23 2021 *)
%o A346064 (Python)
%o A346064 from sympy import isprime
%o A346064 from itertools import combinations, product
%o A346064 def change2(s):
%o A346064     for i, j in combinations(range(len(s)), 2):
%o A346064         for c, d in product("0123456789", repeat=2):
%o A346064             if c != s[i] and d != s[j]:
%o A346064                 yield s[:i] + c + s[i+1:j] + d + s[j+1:]
%o A346064 def a(n): return sum(isprime(int(t)) for t in change2(str(n)))
%o A346064 print([a(n) for n in range(10, 101)]) # _Michael S. Branicky_, Jul 23 2021
%Y A346064 Cf. A345289 (indices of record lows).
%Y A346064 Cf. A209252 (changing one digit).
%K A346064 nonn,base
%O A346064 10,1
%A A346064 _Franz Vrabec_, Jul 03 2021