OFFSET
1,1
COMMENTS
Imagine that each digit of n is on a wheel on a combination lock and each wheel is being rotated two notches for each application of the function. Thus for the digits 0 to 7, the replacement digit is simply the digit+2, but for 8 the replacement digit is 0 and for 9 the replacement digit is 1. Thus 227 --> 449 --> 661 --> 883 --> 5 (initial zeros are dropped on results.)
LINKS
Harvey P. Dale, Table of n, a(n) for n = 1..1000
EXAMPLE
a(8)=227 because (i) 227 is a prime and (ii) incrementing each digit of 227 by 2 yields 449 which is a prime and (iii) incrementing each digit of 449 by 2 (ignoring carries) yields 661 which is a prime
MATHEMATICA
p3Q[n_]:=AllTrue[Rest[NestList[FromDigits[Mod[IntegerDigits[#]+2, 10]]&, n, 2]], PrimeQ]; Select[Prime[Range[1100]], p3Q] (* The program uses the AllTrue function from Mathematica version 10 *) (* Harvey P. Dale, Dec 30 2017 *)
PROG
Function Cycle222(long: p): long {i: integer; r: long; c: integer; for i=floor(log10(p)) to 0 step -1; c = floor(p/10^(i-1)) mod 10; r = r*10 + ((c+2) mod 10); next i; return r; } p=2; for i=1 to 90; n=sequence.count; do while sequence.count=n; j=cycle222(p); if isprime(j) and isprime(cycle222(j)) then sequence.add(p) else p=nextPrimeAfter(p); loop; next i;
CROSSREFS
KEYWORD
base,nonn
AUTHOR
Chuck Seggelin (barkeep(AT)plastereddragon.com), Oct 16 2003
STATUS
approved