[go: up one dir, main page]

login
Search: a204232 -id:a204232
     Sort: relevance | references | number | modified | created      Format: long | short | data
Numbers whose reversed digit representation is prime.
+10
17
2, 3, 5, 7, 11, 13, 14, 16, 17, 20, 30, 31, 32, 34, 35, 37, 38, 50, 70, 71, 73, 74, 76, 79, 91, 92, 95, 97, 98, 101, 104, 106, 107, 110, 112, 113, 118, 119, 124, 125, 128, 130, 131, 133, 134, 136, 140, 142, 145, 146, 149, 151, 152, 157, 160, 164, 166, 167, 170, 172
OFFSET
1,1
COMMENTS
If m is a term, then 10*m is another term. - Bernard Schott, Nov 20 2021
LINKS
Michael S. Branicky, Table of n, a(n) for n = 1..11018 (all terms < 10**5)
EXAMPLE
The number 70 in reverse is 07 = 7, which is prime.
MAPLE
q:= n-> (s-> isprime(parse(cat(s[-i]$i=1..length(s)))))(""||n):
select(q, [$1..200])[]; # Alois P. Heinz, Aug 22 2021
MATHEMATICA
Select[Range[200], PrimeQ[FromDigits[Reverse[IntegerDigits[#]]]] &] (* Harvey P. Dale, Jun 13 2013 *)
PROG
(PARI) r(n) = for(x=1, n, y=eval(rev(x)); if(isprime(y), print1(x", "))) \ Get the reverse of the input string rev(str) = { local(tmp, j, s); tmp = Vec(Str(str)); s=""; forstep(j=length(tmp), 1, -1, s=concat(s, tmp[j])); return(s) }
(PARI) is_A095179(n)=isprime(eval(Strchr(vecextract(Vec(Vecsmall(Str(n))), "-1..1")))) \\ M. F. Hasler, Jan 13 2012
(PARI) isok(n) = isprime(fromdigits(Vecrev(digits(n)))); \\ Michel Marcus, Aug 22 2021
(Python)
from sympy import isprime
def ok(n): return isprime(int(str(n)[::-1]))
print(list(filter(ok, range(1, 173)))) # Michael S. Branicky, Aug 22 2021
CROSSREFS
Cf. A004086, A007500 (primes in this sequence), A076055 (composites in this sequence), A204232 (base-2 analog), A097312.
KEYWORD
base,easy,nonn
AUTHOR
Cino Hilliard, Jun 21 2004
EXTENSIONS
Offset corrected to 1 by Alonso del Arte, Apr 12 2020
STATUS
approved
Smallest base in which n's digital reversal is prime, or 0 if no such base exists.
+10
2
0, 0, 3, 2, 0, 2, 2, 2, 4, 6, 2, 2, 2, 2, 2, 3, 8, 2, 3, 3, 2, 3, 2, 2, 2, 2, 2, 9, 2, 2, 6, 2, 4, 3, 2, 3, 12, 2, 6, 3, 2, 2, 6, 2, 2, 3, 2, 2, 2, 3, 2, 9, 2, 2, 3, 2, 2, 3, 2, 4, 12, 2, 2, 3, 12, 3, 6, 2, 2, 3, 10, 2, 6, 2, 2, 3, 10, 2, 26, 3, 2, 27, 2, 2
OFFSET
0,3
COMMENTS
0 and 1 are not prime and are single digits in all bases, so no reversal of digits can make them prime. a(n) is therefore 0 for both.
4 is not prime and so cannot be prime if reversed in any base where it is a single digit. This leaves bases 2 and 3 where, upon reversal, it is 1 and 4 respectively. Neither are prime, and so a(4) is also 0.
Conjecture 1: 0, 1 and 4 are the only values where there is no base in which a digital reversal makes a prime.
It is clear that for any prime p, a(p) cannot be zero, since a(p)=p+1 is a solution if there is none smaller.
Conjecture 2: n = 2 is the only prime p which must be represented in base p+1, i.e., trivially, as a single digit, in order for its reversal to be prime.
Corollary: Since a(n) cannot be n itself -- reversing n in base n obtains 1, which is not prime -- this would mean that for all positive n except 2, a(n) < n.
Other than its small magnitude, a(n) = 2 occurs often due to the fact that a reversed positive binary number is guaranteed to be odd and thus stands a greater chance of being prime.
Similarly, many solutions exist solely because reversal removes all powers of the base from n, reducing the number of divisors. Thus based solely on observation:
Conjecture 3: With the restriction gcd(base,n) = 1, a(n) = 0 except for n = 2, 3 and 6k+-1, for positive integer k, i.e., terms of A038179.
LINKS
EXAMPLE
9 in base 2 is 1001, which when reversed is the same and so not prime. In base 3 it is 100, which becomes 1 when reversed and also not prime. Base 4: 21 -> 12 (6 decimal), not prime; Base 5: 14 -> 41 (21 decimal), not prime; Base 6: 13 -> 31 (19 decimal), which is prime, so a(9) = 6, i.e., 6 is the smallest base in which 9's digital reversal is a prime number.
PROG
(Python)
from sympy import isprime
from sympy.ntheory.digits import digits
def okb(n, b):
return isprime(sum(d*b**i for i, d in enumerate(digits(n, b)[1:])))
def a(n):
for b in range(2, n+2):
if okb(n, b): return b
return 0
print([a(n) for n in range(84)]) # Michael S. Branicky, Sep 06 2021
CROSSREFS
Positions of 2's: A204232.
KEYWORD
nonn,base,easy
AUTHOR
Carl R. White, Nov 01 2013
STATUS
approved

Search completed in 0.004 seconds