cp's OEIS Frontend

This is a front-end for the Online Encyclopedia of Integer Sequences, made by Christian Perfect. The idea is to provide OEIS entries in non-ancient HTML, and then to think about how they're presented visually. The source code is on GitHub.

A330491 Non-palindromic balanced primes in base 3.

This page as a plain text file.
%I A330491 #15 Dec 27 2019 18:27:10
%S A330491 137,991,1109,1237,1291,1301,1471,1663,1721,1861,1871,7057,7219,7507,
%T A330491 7537,7699,8291,8597,8707,9091,9587,9697,9857,10159,10163,10211,10273,
%U A330491 10321,10627,10631,10739,11027,11437,11551,11777,11887,12239,12401,12659,12671,12821
%N A330491 Non-palindromic balanced primes in base 3.
%C A330491 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.
%C A330491 These are the primes in A256083, respectively the intersection of A000040 and A256083.
%H A330491 Thorben Böger, <a href="/A330491/b330491.txt">Table of n, a(n) for n = 1..19999</a>
%e A330491 a(7) = 1471 as 1471 is prime and 2000111 in base 3, which is balanced: 3*2 = 1*1 + 2*1 + 3*1.
%o A330491 (Python)
%o A330491 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)))]
%o A330491 (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
%Y A330491 Cf. A029971, A256083, A256076, A000040.
%K A330491 nonn,base
%O A330491 1,1
%A A330491 _Thorben Böger_, Dec 16 2019