サタン・プライムズ
who are they?
they are Primes
containing 666
these are
サタン・プライムズ:[46663,266677,666599,666683,616669]
these are NOT
:[462667,665669,36363631,555]
プロット
Every number bigger than 6661 has サタン・プライムズ behind
him
チャレンジ
Given an integer n>6661
find the Satan-Prime
behind (or equal) and closest to itself.
例
Integer n=30000
has 3 サタン・プライムズ(SP) behind
it:[6661, 16661, 26669]
.
Your code must return 26669
which is the closest
behind it
テストケース
Input->Output
6662->6661
10000->6661
66697->66697 (a SP returns himself)
328765->326663
678987->676661
969696->966677
ルール
Yorコードは、ご使用の言語の範囲内の n
で動作するはずです。
This is code-golf,
so the shortest answer in bytes wins!
ベストアンサー
Jelly, 10 9 bytes
@Dennisのおかげで10%節約!
ÆRwÐf666Ṫ
説明
ÆR # All primes in range [2, input]
Ðf # Keep those which satisfy
w # truthy if y is in x
666 # ^ (this is y)
Ṫ # Tail (take the last element)