OFFSET
1,1
COMMENTS
A number is called "balanced" here if the sum of digits weighted by their arithmetic distance from the "center" of the number is zero. Palindromic primes (A029971) are "trivially" balanced, so they are excluded here.
LINKS
Thorben Böger, Table of n, a(n) for n = 1..19999
EXAMPLE
a(7) = 1471 as 1471 is prime and 2000111 in base 3, which is balanced: 3*2 = 1*1 + 2*1 + 3*1.
PROG
(Python)
from primes_file import primes#list containing first 3 million primesfrom baseconvert import base as bdef isbalanced(converted): return sum([(place - (len(converted)/2 - 0.5))*digit for place, digit in enumerate(converted)]) == 0balanced_primes_list = [prime for prime in primes if(b(prime, 10, 3) != b(prime, 10, 3)[::-1] and isbalanced(b(prime, 10, 3)))]
(PARI) ok(n)={my(v=digits(n, 3)); isprime(n) && !sum(i=1, #v, v[i]*((#v+1)/2-i)) && Vecrev(v)<>v} \\ Andrew Howroyd, Dec 23 2019
CROSSREFS
KEYWORD
nonn,base
AUTHOR
Thorben Böger, Dec 16 2019
STATUS
approved