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.
%I A039634 #22 Jul 25 2023 07:17:55 %S A039634 1,2,3,2,5,3,7,2,2,5,11,3,13,7,7,2,17,2,19,5,5,11,23,3,3,13,13,7,29,7, %T A039634 31,2,2,17,17,2,37,19,19,5,41,5,43,11,11,23,47,3,3,3,3,13,53,13,13,7, %U A039634 7,29,59,7,61,31,31,2,2,2,67,17,17,17,71,2,73,37,37,19,19,19,79,5,5 %N A039634 Fixed point of "n -> n/2 or (n-1)/2 until result is prime". %C A039634 a(n) is the largest prime whose binary expansion is an initial substring of n's binary expansion. - _Charlie Neder_, Oct 27 2018 %C A039634 a(1) = 1 by convention. - _David A. Corneth_, Oct 27 2018 %H A039634 Reinhard Zumkeller, <a href="/A039634/b039634.txt">Table of n, a(n) for n = 1..10000</a> %t A039634 ner[ n_Integer ] := FixedPoint[ If[ EvenQ[ # ]&&#>2, #/2, If[ PrimeQ[ # ]||(#=== 1), #, (#-1)/2 ] ]&, n, 20 ] %o A039634 (Haskell) %o A039634 a039634 1 = 1 %o A039634 a039634 n = until ((== 1) . a010051) (flip div 2) n %o A039634 -- _Reinhard Zumkeller_, Nov 17 2013 %o A039634 (PARI) a(n)=while(n>3 && !isprime(n), n\=2); n \\ _Charles R Greathouse IV_, Jun 23 2017 %o A039634 (Python) %o A039634 from sympy import isprime %o A039634 def a(n): %o A039634 while n>1 and not isprime(n): n>>=1 %o A039634 return n %o A039634 print([a(n) for n in range(1, 82)]) # _Michael S. Branicky_, Jul 24 2023 %Y A039634 Cf. A039635-A039645, A010051, A039636, A039638, A039639. %K A039634 nonn,easy,nice %O A039634 1,2 %A A039634 _Wouter Meeussen_ %E A039634 Offset corrected by _Reinhard Zumkeller_, Nov 17 2013