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-3 of 3 results.

A118118 Composite numbers that always remain composite when a single decimal digit of the number is changed.

Original entry on oeis.org

200, 204, 206, 208, 320, 322, 324, 325, 326, 328, 510, 512, 514, 515, 516, 518, 530, 532, 534, 535, 536, 538, 620, 622, 624, 625, 626, 628, 840, 842, 844, 845, 846, 848, 890, 892, 894, 895, 896, 898, 1070, 1072, 1074, 1075, 1076, 1078, 1130
Offset: 1

Views

Author

Adam Panagos (adam.panagos(AT)gmail.com), May 12 2006

Keywords

Comments

The term "prime-proof" for this property is found on projecteuler.net (cf. link). The nontrivial subsequence A143641 is that of odd elements not ending in 5 (i.e. not ending in 0,2,4,5,6 or 8); it starts 212159,595631,872897,... - M. F. Hasler, Sep 04 2008
Also indices n such that A209252(n) is zero. - Ray G. Opao, Aug 01 2020

Examples

			a(1) = 200 is in the sequence because changing any digit of 200 (for example 300, 220, or 209) is still composite. The integer 100 is not in the sequence because it can be changed to 107 which is prime.
		

Crossrefs

Programs

  • Magma
    IsA118118:=function(n); D:=Intseq(n); return forall{ : k in [1..#D], j in [0..9] | j eq D[k] or not IsPrime(Seqint(S)) where S:=Insert(D, k, k, [j]) }; end function; [ n: n in [1..1200] | IsA118118(n) ]; // Klaus Brockhaus, Feb 28 2011
    
  • Mathematica
    unprimeableQ[n_] := Block[{d = IntegerDigits@ n, t = {}}, Do[AppendTo[t, FromDigits@ ReplacePart[d, i -> #] & /@ DeleteCases[Range[0, 9], x_ /; x == d[[i]]]], {i, Length@ d}]; ! AnyTrue[Flatten@ t, PrimeQ]]; Select[Range@ 1200, unprimeableQ] (* Michael De Vlieger, Nov 09 2015, Version 10 *)
  • PARI
    /* return 1 if no digit can be changed to make it prime; if d=1, print a prime if n is not prime-proof */ isA118118(n,d=0)={ forstep( k=n\10*10+1, n\10*10+9,2, isprime(k) || next; d && print("prime:",k); return); if( n%2==0 || n%5==0, /* even or ending in 5: no other digit can make it prime, except for the case where the last digit is prime and the first digit is the only other nonzero one */ return( !isprime(n%10) || 9 < n % 10^( log(n+.5)\log(10) ) || (d && print("prime:",n%10)) )); o=10; until( n < o*=10, k=n-o*(n\o%10); for( i=0,9, isprime(k) && return(d && print("prime:",k)); k+=o));1} \\ M. F. Hasler, Sep 04 2008
    
  • Python
    from sympy import isprime
    def selfplusneighs(n):
        s = str(n); d = "0123456789"; L = len(s)
        yield from (int(s[:i]+c+s[i+1:]) for c in d for i in range(L))
    def ok(n): return all(not isprime(k) for k in selfplusneighs(n))
    print([k for k in range(1131) if ok(k)]) # Michael S. Branicky, Jun 19 2022

Extensions

Edited by Charles R Greathouse IV, Aug 05 2010

A192545 Numbers such that all numbers are composite when replacing exactly one digit with another, except the leading digit with zero.

Original entry on oeis.org

200, 202, 204, 205, 206, 208, 320, 322, 324, 325, 326, 328, 510, 512, 514, 515, 516, 518, 530, 532, 534, 535, 536, 538, 620, 622, 624, 625, 626, 628, 840, 842, 844, 845, 846, 848, 890, 892, 894, 895, 896, 898, 1070, 1072, 1074, 1075, 1076, 1078, 1130, 1132
Offset: 1

Views

Author

Reinhard Zumkeller, Jul 05 2011

Keywords

Comments

A048853(a(n)) = 0;
Intersection of this sequence and A000040 is A158124. - Evgeny Kapun, Dec 13 2016
If the last digit of an element is 0, 2, 4, 5, 6 or 8, then replacing it with 0, 2, 4, 5, 6 or 8 also yields an element. - David A. Corneth and corrected by Evgeny Kapun, Dec 13 2016

Crossrefs

Programs

  • Haskell
    import Data.List (elemIndices)
    a192545 n = a192545_list !! (n-1)
    a192545_list = map (+ 1) $ elemIndices 0 $ map a048853 [1..]
  • Mathematica
    Select[Range@ 1200, Function[w, Total@ Boole@ Flatten@ Map[Function[d, PrimeQ@ FromDigits@ ReplacePart[w, d -> #] & /@ If[d == 1, #, Prepend[#, 0]] &@ Range@ 9], Range@ Length@ w] == 0]@ IntegerDigits@ # &] (* Michael De Vlieger, Dec 13 2016 *)

A186694 Numbers ending in 1, 3, 7 or 9 such that changing any one decimal digit produces a composite number.

Original entry on oeis.org

212159, 294001, 505447, 584141, 595631, 604171, 872897, 971767, 1062599, 1203623, 1282529, 1293671, 1524181, 1566691, 1702357, 1830661, 2017963, 2474431, 2690201, 3085553, 3326489, 3716213, 3964169, 4103917, 4134953, 4173921, 4310617, 4376703
Offset: 1

Views

Author

Arkadiusz Wesolowski, Feb 25 2011

Keywords

Comments

Union of A050249 and A143641.
This sequence is infinite because Terence Tao proved that sequence A050249 is infinite.

Crossrefs

Programs

  • Mathematica
    primeProof[n_] := Module[{d, e, isPP, num}, d=IntegerDigits[n]; isPP=True; Do[e=d; e[[i]]=j; num=FromDigits[e]; If[num != n && PrimeQ[num], isPP=False; Break[]], {i, Length[d]}, {j, 0, 9}]; isPP]; Select[Range[1, 1000000, 2], Mod[#, 5] > 0 && primeProof[#] &] (* T. D. Noe, Feb 26 2011 *)
Showing 1-3 of 3 results.