<commit_before>/* Grafting
 * 2013 <NAME> <<EMAIL>>
 *
 * A toy to find and display grafting numbers, as defined by <NAME>er.
 * See the Numberphile video at http://www.youtube.com/watch?v=hiOMtBrH8pc for info.
 */

var grafting = (function() {
	const PRECISION = 20;
	var dom = {
		size : undefined,
		start : undefined,
		results : undefined
	};

	function range(min, max) {
		var sequence = [];
		var reverse = (min > max);
		if (reverse) {
			for (var i = min; i > max; i--) {
				sequence.push(i);
			}
		} else {
			for (var i = min; i < max; i++) {
				sequence.push(i);
			}
		}
		return sequence;
	}

	function getGraftingNumbers(limit) {
		display(range(0, limit).filter(isGraftingNumber));
	}

	function isGraftingNumber(number) {
		var rootDigits = Math.sqrt(number).toFixed(PRECISION).replace('.', '');
		var numberDigits = number.toFixed(0);
		return (rootDigits.indexOf(numberDigits) !== -1);
	}

	function format(number) {
		var root = Math.sqrt(number).toFixed(PRECISION);
		var rootDigits = root.replace('.', '');<commit_msg>Switched to the strict "non-boring" definition of grafting numbers.<commit_after>/* Grafting
 * 2013 <NAME> <<EMAIL>>
 *
 * A toy to find and display grafting numbers, as defined by <NAME>.
 * See the Numberphile video at http://www.youtube.com/watch?v=hiOMtBrH8pc for info.
 */

var grafting = (function() {
	const PRECISION = 20;
	var dom = {
		size : undefined,
		start : undefined,
		results : undefined
	};

	function range(min, max) {
		var sequence = [];
		var reverse = (min > max);
		if (reverse) {
			for (var i = min; i > max; i--) {
				sequence.push(i);
			}
		} else {
			for (var i = min; i < max; i++) {
				sequence.push(i);
			}
		}
		return sequence;
	}

	function getGraftingNumbers(limit) {
		display(range(0, limit).filter(isGraftingNumber));
	}

	function isGraftingNumber(number) {
		var root = Math.sqrt(number).toFixed(PRECISION);
		var rootDigits = root.replace('.', '');
		var numberDigits = number.toFixed(0);
		var decimalPointPosition = root.indexOf('.');
		var matchPosition = rootDigits.indexOf(numberDigits);
		return (matchPosition !== -1 && decimalPointPosition >= matchPosition);
	}

	function format(number) {
		var root = Math.sqrt(number).toFixed(PRECISION);
		var rootDigits = root.replace('.', '');
{'fraction_non_alphanumeric': 0.15418309242225142, 'fraction_numerical': 0.008760402978537012, 'mean_word_length': 3.614141414141414, 'pattern_counts': {'":': 0, '<': 13, '<?xml version=': 0, '>': 16, 'https://': 0, 'lorem ipsum': 0, 'www.': 2, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '4570314', 'n_tokens_mistral': 882, 'n_tokens_neox': 785, 'n_words': 203}