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.

A063131 Odd composite numbers which in base 2 contain their largest proper factor as a substring of digits.

This page as a plain text file.
%I A063131 #14 Sep 08 2022 08:45:03
%S A063131 55,91,215,407,493,893,1189,1343,1403,1643,1681,1961,3151,3223,3415,
%T A063131 4063,4579,7087,7597,7979,8791,9167,10579,11227,13303,13655,14219,
%U A063131 15487,16147,22939,23479,24341,25751,26101,27571,28757,30461,30607
%N A063131 Odd composite numbers which in base 2 contain their largest proper factor as a substring of digits.
%C A063131 The Pascal program checks to n=100000 in about a second on a 2GHz desktop, about three times as fast than the Mathematica program.
%H A063131 Amiram Eldar, <a href="/A063131/b063131.txt">Table of n, a(n) for n = 1..10000</a>
%t A063131 Do[ If[ !PrimeQ[ n ] && StringPosition[ ToString[ FromDigits[ IntegerDigits[ n, 2 ] ] ], ToString[ FromDigits[ IntegerDigits[ Divisors[ n ] [ [ -2 ] ], 2 ] ] ] ] != {}, Print[ n ] ], {n, 3, 500, 2} ]
%o A063131 (Pascal) program A063131; var n,nn,lpd:longint; nstr,dstr:string; function prime(n:longint; var d:longint):boolean; var sq,i:longint; begin{PRIME} sq := round(sqrt(n)); for i := 2 to sq do if n mod i=0 then begin d := n div i; prime := false; exit; end; prime := true; end{PRIME}; begin{MAIN} for n := 3 to 100000 do if (n mod 2=1) and (not prime(n,lpd)) then begin nn := n; nstr := ''; repeat if nn mod 2=1 then nstr := '1'+nstr else nstr := '0'+nstr; nn := nn div 2; until nn=0; dstr := ''; repeat if lpd mod 2=1 then dstr := '1'+dstr else dstr := '0'+dstr; lpd := lpd div 2; until lpd=0; if pos(dstr,nstr)>0 then write(n:8); end; end.
%o A063131 (Magma) [k:k in [3..31000 by 2] | not IsPrime(k) and IntegerToString(Seqint(Intseq(Max(Set(Divisors(k)) diff {k}),2))) in IntegerToString(Seqint(Intseq(k)),2)]; // _Marius A. Burtea_, Jan 29 2020
%o A063131 (Python)
%o A063131 from sympy import divisors, isprime
%o A063131 def ok(n):
%o A063131     if n < 4 or n&1 == 0 or isprime(n): return False
%o A063131     return bin(divisors(n)[-2])[2:] in bin(n)[2:]
%o A063131 print([k for k in range(10**5) if ok(k)]) # _Michael S. Branicky_, Jul 29 2022
%Y A063131 Cf. A062238, A063127.
%K A063131 base,nonn
%O A063131 1,1
%A A063131 _Robert G. Wilson v_, Aug 08 2001
%E A063131 Extended and edited by _John W. Layman_, Apr 06 2002