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.

Showing 1-2 of 2 results.

A372770 Primes in A284798.

Original entry on oeis.org

13, 97, 853, 1021, 1093, 7873, 8161, 8377, 9337, 12241, 62989, 63853, 66733, 74797, 79861, 81373, 82021, 84181, 86413, 91381, 92317, 94477, 95773, 98893, 100189, 101701, 111997, 114157, 534841, 552553, 556441, 560977, 578689, 580633, 591937, 600361, 631249
Offset: 1

Views

Author

Stanislav Kruml, May 12 2024

Keywords

Comments

The base-b expansion (d_1)(d_2)...(d_m) of a number is antipalindromic if, for each of its m digits, it holds that d_k + d_{m-k+1} = b-1.
In a base other than 3, there is at most a single antipalindromic prime.
All terms have an odd number of base-3 digits. - Robert Israel, Mar 14 2025

Examples

			For m = 3, the only solution is 13 = 111_3.
For m = 5, the only solution is 97 = 10121_3.
		

Crossrefs

Cf. A284798.

Programs

  • Maple
    arev3:= proc(n) local L,i;
        L:= convert(n,base,3);
        add((2-L[-i])*3^(i-1),i=1..nops(L))
    end proc;
    qprime:= proc(x) if isprime(x) then x fi end proc:
    F:= proc(d) local x,y;
        seq(qprime(x*3^((d+1)/2) + 3^((d-1)/2) + arev3(x)),x=3^((d-3)/2)..2*3^((d-3)/2)-1)
    end proc;
    [seq(F(i),i=3..13,2)]; # Robert Israel, Mar 14 2025
  • Mathematica
    Select[Prime[Range[52000]], FromDigits[Reverse[2 - IntegerDigits[#, 3]], 3] == # &] (* Amiram Eldar, Jun 16 2024 *)
  • Python
    from sympy import isprime
    from itertools import count, islice, product
    def bgen(): # generator of terms of A284798
        yield 1
        for d in count(2):
            for first in [1, 2]:
                for rest in product([0, 1, 2], repeat=(d-2)//2):
                    left, mid = (first,) + rest, (1,) if d&1 else tuple()
                    right = tuple([2-d for d in left][::-1])
                    yield int("".join(str(d) for d in left + mid + right), 3)
    def agen(): yield from filter(isprime, bgen())
    print(list(islice(agen(), 40))) # Michael S. Branicky, Jun 16 2024

A284797 Write in base k, complement, reverse. Case k = 3.

Original entry on oeis.org

2, 1, 0, 7, 4, 1, 6, 3, 0, 25, 16, 7, 22, 13, 4, 19, 10, 1, 24, 15, 6, 21, 12, 3, 18, 9, 0, 79, 52, 25, 70, 43, 16, 61, 34, 7, 76, 49, 22, 67, 40, 13, 58, 31, 4, 73, 46, 19, 64, 37, 10, 55, 28, 1, 78, 51, 24, 69, 42, 15, 60, 33, 6, 75, 48, 21, 66, 39, 12, 57, 30
Offset: 0

Views

Author

Paolo P. Lava, Apr 03 2017

Keywords

Examples

			a(9) = 25 because 9 in base 3 is 100, its complement in base 3 is 122 and the digit reverse is 221 that is 25 in base 10.
		

Crossrefs

Programs

  • Maple
    P:=proc(q,h) local a,b,k,n; print(h-1); for n from 1 to q do a:=convert(n,base,h); b:=0;
    for k from 1 to nops(a) do a[k]:=h-1-a[k]; b:=h*b+a[k]; od; print(b); od; end: P(10^2,3);
  • Mathematica
    Table[FromDigits[Reverse[2-IntegerDigits[n,3]],3],{n,0,70}] (* Harvey P. Dale, Sep 08 2019 *)
  • Python
    from gmpy2 import digits
    def A284797(n): return -int((s:=digits(n,3)[::-1]),3)-1+3**len(s) # Chai Wah Wu, Feb 04 2022
Showing 1-2 of 2 results.