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.

Previous Showing 21-30 of 30 results.

A318785 Numbers which are prime if each digit is replaced by its 9's complement.

Original entry on oeis.org

2, 4, 6, 7, 10, 16, 20, 26, 28, 32, 38, 40, 46, 52, 56, 58, 62, 68, 70, 76, 80, 82, 86, 88, 92, 94, 96, 97, 112, 116, 118, 122, 136, 140, 142, 146, 160, 170, 172, 176, 178, 188, 190, 202, 212, 226, 230, 238, 242, 248, 256, 260, 266, 272, 280, 290, 298, 308, 316, 322, 326, 338, 340, 346, 352, 356, 358
Offset: 1

Views

Author

Pierandrea Formusa, Sep 03 2018

Keywords

Examples

			32 belongs to this sequence as its 9's complement is 67, which is prime.
		

Crossrefs

Cf. A061601 (9's complement of n).

Programs

  • PARI
    complement(n) = my(d=digits(n)); for(k=1, #d, d[k]=9-d[k]); subst(Pol(d), x, 10)
    is(n) = ispseudoprime(complement(n)) \\ Felix Fröhlich, Sep 03 2018
  • Python
    nmax=500
    def is_prime(num):
        if num == 0 or num == 1: return(0)
        for k in range(2, num):
           if (num % k) == 0:
               return(0)
        return(1)
    def c9(num):
        s=str(num)
        l=len(str(num))
        n=""
        for k in range(l):
            n = n+str(9-int(s[k]))
        return(int(n))
    ris = ""
    for i in range(2,nmax):
        if is_prime(c9(i)):
           ris = ris+str(i)+","
    print(ris)
    

A383787 Largest number obtainable by either keeping each decimal digit d in n or replacing it with 9-d.

Original entry on oeis.org

8, 7, 6, 5, 5, 6, 7, 8, 9, 89, 88, 87, 86, 85, 85, 86, 87, 88, 89, 79, 78, 77, 76, 75, 75, 76, 77, 78, 79, 69, 68, 67, 66, 65, 65, 66, 67, 68, 69, 59, 58, 57, 56, 55, 55, 56, 57, 58, 59, 59, 58, 57, 56, 55, 55, 56, 57, 58, 59, 69, 68, 67, 66, 65, 65, 66, 67, 68, 69, 79, 78, 77, 76, 75, 75, 76, 77, 78
Offset: 1

Views

Author

Ali Sada, May 09 2025

Keywords

Examples

			To find a(129) we replace 1 with 8 and 2 with 7. So, a(129) = 879.
		

Crossrefs

Programs

  • Mathematica
    a[n_] := FromDigits[IntegerDigits[n] /. d_?(# < 5 &) -> 9 - d]; Array[a, 100] (* Amiram Eldar, May 10 2025 *)
  • PARI
    a(n) = fromdigits(apply(x->(if (x<5, 9-x, x)), digits(n))); \\ Michel Marcus, May 12 2025
  • Python
    def a(n): return int("".join(d if d>"4" else str(9-int(d)) for d in str(n)))
    print([a(n) for n in range(1, 79)]) # Michael S. Branicky, May 10 2025
    

A069000 Numbers k such that k * (digit complement of k) is a square.

Original entry on oeis.org

0, 9, 99, 972, 999, 9900, 9999, 39024, 60975, 99999, 168399, 307692, 467775, 532224, 692307, 831600, 972972, 999999, 9946224, 9999999, 11678832, 12328767, 18797427, 19584972, 32618124, 42245775, 47819475, 52180524, 57754224, 67381875, 80415027, 81202572
Offset: 1

Views

Author

Joseph L. Pe, Mar 20 2002

Keywords

Comments

The digit complement of a digit d is 9 - d; e.g., 8 and 3 have complements 1, 6, respectively. The digit complement of a number k is the number formed by replacing each digit of k by its complement; e.g., 83 has complement 16.

Examples

			972972 has complement 27027 (the leading 0 is ignored). 972972 * 27027 = 162162^2, so 972972 is a term of the sequence.
		

Crossrefs

Cf. A061601 (9's complement).
A002283 is a subsequence.

Programs

  • Mathematica
    j[n_] := 9 - n; Do[If[IntegerQ[Sqrt[n*FromDigits[Map[j, IntegerDigits[n]]]]], Print[n]], {n, 1, 10^6}]
    Select[Range[0,81203000],IntegerQ[Sqrt[# FromDigits[9-IntegerDigits[ #]]]]&] (* Harvey P. Dale, Jun 26 2021 *)
  • PARI
    isok(n) = {d = digits(n); nd = vector(#d, k, 9-d[k]); issquare(n*fromdigits(nd));}

Extensions

More terms from Robert G. Wilson v, Apr 08 2002
a(1), a(21)-a(32) from Giovanni Resta, Apr 14 2017

A085927 a(n) is the digitwise absolute difference between the n-th palindrome and its 9's complement.

Original entry on oeis.org

7, 5, 3, 1, 1, 3, 5, 7, 9, 77, 55, 33, 11, 11, 33, 55, 77, 99, 797, 777, 757, 737, 717, 717, 737, 757, 777, 797, 595, 575, 555, 535, 515, 515, 535, 555, 575, 595, 393, 373, 353, 333, 313, 313, 333, 353, 373, 393, 191, 171, 151, 131, 111, 111, 131, 151, 171, 191
Offset: 1

Views

Author

Amarnath Murthy and Jason Earls, Jul 13 2003

Keywords

Examples

			a(24) = 717 because A002113(24) = 151 and A061601(151) = 848. 8-1 = 7 and 5-4 = 1, thus 717.
		

Crossrefs

Programs

  • Python
    from sympy import isprime
    from itertools import count, product
    def f(s): return int("".join(str(abs(9 - 2*int(c))) for c in s))
    def pals(base=10): # all (nonzero) palindromes as strings
        digits = "".join(str(i) for i in range(base))
        for d in count(1):
            for p in product(digits, repeat=d//2):
                if d > 1 and p[0] == "0": continue
                left = "".join(p); right = left[::-1]
                for mid in [[""], digits][d%2]:
                    t = left + mid + right
                    if t != '0': yield t
    def aupton(nn): p = pals(); return [f(next(p)) for i in range(nn)]
    print(aupton(58)) # Michael S. Branicky, Jul 05 2021
    
  • Python
    def A085927(n):
        y = 10*(x:=10**(len(str(n+1>>1))-1))
        m = str((c:=n+1-x)*x+int(str(c)[-2::-1] or 0) if n+1Chai Wah Wu, Jul 24 2024

Extensions

Edited and extended by David Wasserman, Feb 11 2005

A296130 Replace each digit of n with its complement to 9; this will reproduce all digits of n in a different order.

Original entry on oeis.org

18, 27, 36, 45, 54, 63, 72, 81, 90, 1089, 1098, 1188, 1278, 1287, 1368, 1386, 1458, 1485, 1548, 1584, 1638, 1683, 1728, 1782, 1809, 1818, 1827, 1836, 1845, 1854, 1863, 1872, 1881, 1890, 1908, 1980, 2079, 2097, 2178, 2187, 2277, 2367, 2376, 2457, 2475, 2547, 2574, 2637, 2673, 2709, 2718
Offset: 1

Views

Author

Eric Angelini and Jean-Marc Falcoz, Feb 14 2018

Keywords

Comments

The complement of 0 is 9, of 1 is 8, of 2 is 7, etc. All terms of the sequence have an even number of digits, and all terms are divisible by 9.

Examples

			18 produces 81 when 1 is replaced by 8 and 8 is replaced by 1; 18 and 81 use the same set of digits, in a different order.
1089 produces 8910 when 1 is replaced by 8, 0 by 9, 8 by 1 and 9 by 0; 1089 and 8910 use the same set of digits, in a different order.
		

Crossrefs

Cf. A061601.

Programs

  • PARI
    replace_digits(n) = my(d=digits(n)); for(k=1, #d, d[k]=abs(d[k]-9)); d
    is(n) = vecsort(digits(n))==vecsort(replace_digits(n)) \\ Felix Fröhlich, Feb 14 2018

A377471 Smallest prime such that the number of distinct prime factors of its 9's complement is equal to n. If no such number exists return -1.

Original entry on oeis.org

2, 3, 29, 229, 10273, 1000099, 1061069, 101872769, 1569793669, 20207116829, 1069666778189, 102533896856389, 10003581910211789, 1000003754654504609, 100003356331318330889
Offset: 1

Views

Author

Jean-Marc Rebert, Jan 08 2025

Keywords

Examples

			2 is prime, 9-2 = 7 and omega(7) = 1;
		

Crossrefs

Programs

  • PARI
    nc(n) = my(e=length(Str(n))); 10^e-1 - n; \\ A061601
    a(n) = my(p=2); while (omega(nc(p)) != n, p = nextprime(p+1)); p; \\ Michel Marcus, Jan 08 2025

Extensions

a(12)-a(15) from Michael S. Branicky, Jan 12 2025

A383788 Smallest number obtainable by either keeping each decimal digit d in n or replacing it with 9-d.

Original entry on oeis.org

1, 2, 3, 4, 4, 3, 2, 1, 0, 10, 11, 12, 13, 14, 14, 13, 12, 11, 10, 20, 21, 22, 23, 24, 24, 23, 22, 21, 20, 30, 31, 32, 33, 34, 34, 33, 32, 31, 30, 40, 41, 42, 43, 44, 44, 43, 42, 41, 40, 40, 41, 42, 43, 44, 44, 43, 42, 41, 40, 30, 31, 32, 33, 34, 34, 33, 32, 31, 30, 20, 21, 22, 23, 24, 24, 23, 22
Offset: 1

Views

Author

Ali Sada, May 09 2025

Keywords

Examples

			To find a(346), we replace 6 with 3. So, a(346) = 343.
		

Crossrefs

Programs

  • Mathematica
    a[n_] := FromDigits[IntegerDigits[n] /. d_?(# > 4 &) -> 9 - d]; Array[a, 100] (* Amiram Eldar, May 10 2025 *)
  • PARI
    a(n) = fromdigits(apply(x->(if (x>4, 9-x, x)), digits(n))); \\ Michel Marcus, May 12 2025
  • Python
    def a(n): return int("".join(d if d<"5" else str(9-int(d)) for d in str(n)))
    print([a(n) for n in range(1, 78)]) # Michael S. Branicky, May 10 2025
    

A226587 Numbers n having at least two complementary pairs of divisors (q, p) and (p', q') such that n = p*q = p'*q' where the decimal digits of p' are the 9's complement of the decimal digits of p and the decimal digits of q' are the 9's complement of the decimal digits of q.

Original entry on oeis.org

88, 154, 198, 220, 888, 1554, 1998, 2220, 8888, 9768, 15554, 17094, 19998, 21978, 22220, 24420, 88888, 89890, 97768, 105444, 112918, 120190, 127260, 134128, 140794, 147258, 153520, 155554, 159580, 165438, 171094, 176548, 181800, 186850, 191698, 196344, 199998, 200788, 205030
Offset: 1

Views

Author

Michel Lagneau, Sep 02 2013

Keywords

Comments

The 9's complement of a number m equals 10^d - 1 - m where d is the number of digits in m. If u is a digit in m replace it with 9 - u.
A pair of integer (p, q) is complementary for multiplication when the product p*q is the same as the product p'*q' where the decimal digits of p' are the 9's complement of the decimal digits of p and the decimal digits of q' are the 9's complement of the decimal digits of q.
A double pair shows a complementary structure, for example: 77*2 = 7*22; 888*11 = 88*111; 8989*10 = 89*1010.
The sequence is infinite: let two integers x and y with the decimal representation x = ppp...p (i times) and y = (9-p)(9-p)...(9-p) (j times). The product x*y = p*(9-p)*R_i*R_j where R_k is a string of k 1's (or a Repunit number of the form (10^k - 1)/9). But x’ = (9-p)*R_i and y' = p*R_j => x*y => x'*y'.

Examples

			198 is in the sequence because 66*3 = 6*33 = 198.
		

Crossrefs

Programs

  • Maple
    with(numtheory):for n from 1 to 210000 do:x:=divisors(n):n1:=nops(x):ii:=0:for a from 2 to n1-1 while(ii=0) do:m:=n/x[a]:m1:=convert(m, base, 10):nn1:=nops(m1): m2:=convert(x[a], base, 10):nn2:=nops(m2): s1:=sum('(9-m1[i])*10^(i-1)', 'i'=1..nn1): s2:=sum('(9-m2[i])*10^(i-1)', 'i'=1..nn2):for b from a+1 to n1-1 while(ii=0) do:q:=n/x[b]:if s1=q and s2=x[b] and m<>x[b] then ii:=1:printf(`%d, `, n):else fi:od:od:od:
    # warning: there were missing terms, so the above Maple program may be wrong. - N. J. A. Sloane, Sep 17 2017
  • PARI
    compl(n) = my(dn = digits(n)); fromdigits(vector(#dn, k, 9 - dn[k]));
    isok(n) = sumdiv(n, d, if ((d^2= 2; \\ Michel Marcus, Sep 16 2017

Extensions

Missing terms 88, 888, 8888, 88888 added by Michel Marcus, Sep 16 2017

A240696 Prime numbers n such that replacing each digit d in the decimal expansion of n with its 9's complement produces a prime.

Original entry on oeis.org

2, 7, 97, 997, 99999999999999997
Offset: 1

Views

Author

Michel Lagneau, Apr 10 2014

Keywords

Comments

a(n) = {2} union {primes of the form 10^n - 3} = {2} union {A093172}.
Primes p such that A061601(p) is also prime.
The next term has 140 digits.

Examples

			997 is in the sequence because 997 becomes (002) = 2, which is prime.
		

Crossrefs

Programs

  • Mathematica
    lst={};f[n_]:=Block[{a=IntegerDigits[Prime[n]],b="",k=1,l},l=Length[a];While[k
    				

A360324 Numbers k such that k divides Sum_{i=1..k} 10^(1 + floor(log_10(p(i)))) - 1 - p(i), where p(i) is the i-th prime number.

Original entry on oeis.org

1, 13, 313, 1359, 245895, 131186351, 468729047, 1830140937
Offset: 1

Views

Author

Ctibor O. Zizka, Feb 04 2023

Keywords

Comments

Alternative Name : The arithmetic mean of the first k 9's complements of primes is an integer.

Examples

			k = 13: first 13 prime numbers are {2,3,5,7,11,13,17,19,23,29,31,37,41}, their 9's complements are {7,6,4,2,88,86,82,80,76,70,68,62,58} and (7 + 6 + ... + 62 + 58) / 13 = 53, thus 13 is a term.
		

Crossrefs

Programs

  • Mathematica
    s = 0; p = 2; pow = 10; seq = {}; Do[s += pow - 1 - p; If[Divisible[s, k], AppendTo[seq, k]]; p = NextPrime[p]; If[p > pow, pow *= 10], {k, 1, 250000}]; seq (* Amiram Eldar, Feb 04 2023 *)

Formula

k: (Sum_{i=1..k} 10^(1 + floor(log_10(p(i)))) - 1 - p(i)) / k = c, c an integer.

Extensions

a(5)-a(8) from Amiram Eldar, Feb 04 2023
Previous Showing 21-30 of 30 results.