login

Revision History for A125002

(Bold, blue-underlined text is an addition; faded, red-underlined text is a deletion.)

Showing entries 1-10 | older changes
Let p = prime(n); a(n) = number of primes q with same number of digits as p that can be obtained from p by changing one digit.
(history; published version)
#16 by Joerg Arndt at Tue May 10 02:11:02 EDT 2022
STATUS

reviewed

approved

#15 by Michel Marcus at Tue May 10 00:48:29 EDT 2022
STATUS

proposed

reviewed

#14 by Michael S. Branicky at Mon May 09 20:18:36 EDT 2022
STATUS

editing

proposed

#13 by Michael S. Branicky at Mon May 09 20:18:23 EDT 2022
PROG

(Python)

from sympy import isprime, sieve

def neighbors(s):

digs = "0123456789"

ham1 = (s[:i]+d+s[i+1:] for i in range(len(s)) for d in digs if d!=s[i])

yield from (h for h in ham1 if h[0] != '0')

def a(n):

return sum(1 for s in neighbors(str(sieve[n])) if isprime(int(s)))

print([a(n) for n in range(1, 101)]) # Michael S. Branicky, May 09 2022

STATUS

approved

editing

#12 by Jon E. Schoenfield at Wed Aug 12 02:20:34 EDT 2015
STATUS

editing

approved

#11 by Jon E. Schoenfield at Wed Aug 12 02:20:32 EDT 2015
AUTHOR

_Zak Seidov, _, Jan 08 2007

#10 by Jon E. Schoenfield at Wed Aug 12 02:20:20 EDT 2015
MAPLE

A125002 := proc(n) local p, digs, res, r, d; p := ithprime(n) ; digs := convert(p, base, 10) ; res := 0 ; for d from 1 to nops(digs) do for r from 0 to 9 do if r <> op(d, digs) and ( d <> nops(digs) or r > 0) then q := p-(op(d, digs)-r)*10^(d-1) ; if isprime(q) then res := res+1 ; fi ; fi ; od ; od ; RETURN(res) ; end ; for n from 1 to 100 do printf("%d, ", A125002(n)) ; od ; - _# _R. J. Mathar_, Jan 13 2007

STATUS

approved

editing

#9 by Reinhard Zumkeller at Sun Jul 06 00:58:11 EDT 2014
STATUS

editing

approved

#8 by Reinhard Zumkeller at Sun Jul 06 00:54:57 EDT 2014
PROG

(Haskell)

import Data.List (delete)

a125002 n = sum $ map (a010051' . read) $

tail $ concatMap (f pds) [0 .. length pds - 1] where

pds = show $ a000040 n

f ws k = [us ++ [y] ++ vs |

let (us, v:vs) = splitAt k ws, y <- delete v "0123456789"]

-- Reinhard Zumkeller, Jul 06 2014

CROSSREFS

Cf. A000040.

#7 by Reinhard Zumkeller at Sun Jul 06 00:52:06 EDT 2014
LINKS

Reinhard Zumkeller, <a href="/A125002/b125002.txt">Table of n, a(n) for n = 1..10000</a>

STATUS

approved

editing