login
The OEIS is supported by the many generous donors to the OEIS Foundation.

 

Logo

Year-end appeal: Please make a donation to the OEIS Foundation to support ongoing development and maintenance of the OEIS. We are now in our 59th year, we have over 358,000 sequences, and we’ve crossed 10,300 citations (which often say “discovered thanks to the OEIS”).

Other ways to Give
Hints
(Greetings from The On-Line Encyclopedia of Integer Sequences!)
A048853 Number of primes (different from n) that can be produced by altering one digit of decimal expansion of n (without changing the number of digits). 24
4, 3, 3, 4, 3, 4, 3, 4, 4, 4, 7, 4, 8, 4, 4, 4, 7, 4, 7, 2, 7, 2, 6, 2, 2, 2, 7, 2, 5, 2, 5, 2, 8, 2, 2, 2, 5, 2, 7, 3, 6, 3, 7, 3, 3, 3, 6, 3, 8, 2, 7, 2, 6, 2, 2, 2, 7, 2, 5, 2, 5, 2, 8, 2, 2, 2, 5, 2, 7, 3, 6, 3, 7, 3, 3, 3, 8, 3, 6, 2, 7, 2, 6, 2, 2, 2, 7, 2, 5, 1, 6, 1, 7, 1, 1, 1, 4, 1, 6, 4, 10, 4, 8, 4, 4 (list; graph; refs; listen; history; text; internal format)
OFFSET

1,1

COMMENTS

a(A192545(n)) = 0. - Reinhard Zumkeller, Jul 05 2011

LINKS

Reinhard Zumkeller, Table of n, a(n) for n = 1..10000

EXAMPLE

Altering the number 13 gives eight primes: 11, 17, 19, 23, 43, 53, 73, 83, so a(13)=8.

MAPLE

A048853 := proc(n::integer) local resul, ddigs, d, c, tmp ; resul := 0 ; ddigs := convert(n, base, 10) ; for d from 1 to nops(ddigs) do for c from 0 to 9 do if c = 0 and d = nops(ddigs) then continue ; else if c <> op(d, ddigs) then tmp := [op(1..d-1, ddigs), c, op(d+1..nops(ddigs), ddigs)] ; tst := sum(op(i, tmp)*10^(i-1), i=1..nops(tmp)) ; if isprime(tst) then resul := resul+1 ; fi ; fi ; fi ; od : od ; RETURN(resul) ; end: for n from 1 to 90 do printf("%d, ", A048853(n)) ; od ; # R. J. Mathar, Apr 25 2006

MATHEMATICA

a[n_] := Module[{idn = IntegerDigits[n], id, np = 0}, Do[id = idn; If[ id[[j]] != k, id[[j]] = k; If[ id[[1]] != 0 && PrimeQ[ FromDigits[id]], np = np + 1]], {j, 1, Length[idn]}, {k, 0, 9}]; np]; Table[a[n], {n, 1, 105}] (* Jean-François Alcover, Dec 01 2011 *)

PROG

(Haskell)

import Data.List (inits, tails, nub)

a048853 n = (sum $ map (a010051 . read) $ tail $ nub $ concat $ zipWith

(\its tls -> map ((\xs ys d -> xs ++ (d:ys)) its tls) "0123456789")

(map init $ tail $ inits $ show n) (tail $ tails $ show n)) - a010051 n

-- Reinhard Zumkeller, Jul 05 2011

(Python)

from sympy import isprime

def h1(n): # hamming distance 1 neighbors of n, not starting with 0

s = str(n); d = "0123456789"; L = len(s)

yield from (int(s[:i]+c+s[i+1:]) for c in d for i in range(L) if c!=s[i] and not (i==0 and c=="0"))

def a(n): return sum(1 for k in h1(n) if isprime(k))

print([a(n) for n in range(1, 106)]) # Michael S. Branicky, Jul 31 2022

CROSSREFS

Cf. A050652-A050673.

Cf. A010051, A158124.

Sequence in context: A026858 A188885 A129344 * A303701 A179845 A180217

Adjacent sequences: A048850 A048851 A048852 * A048854 A048855 A048856

KEYWORD

base,nonn,easy,nice

AUTHOR

G. L. Honaker, Jr. and Patrick De Geest

STATUS

approved

Lookup | Welcome | Wiki | Register | Music | Plot 2 | Demos | Index | Browse | More | WebCam
Contribute new seq. or comment | Format | Style Sheet | Transforms | Superseeker | Recents
The OEIS Community | Maintained by The OEIS Foundation Inc.

License Agreements, Terms of Use, Privacy Policy. .

Last modified December 3 05:56 EST 2022. Contains 358512 sequences. (Running on oeis4.)