18 "output_type": "execute_result"
22 "# Calculate ( n ** e ) mod b\n",
23 "def modular_exponent(n, e, b)\n",
26 " while e_prime < e\n",
49 "output_type": "execute_result"
53 "modular_exponent 4, 3, 10"
71 "output_type": "execute_result"
75 "def self_powers(n_max, b)\n",
76 " (1..n_max).map {|n| modular_exponent n, n, b}.sum % b\n",
82 "execution_count": 10,
93 "execution_count": 10,
95 "output_type": "execute_result"
99 "self_powers 10, 1000000000000"
104 "execution_count": 11,
115 "execution_count": 11,
117 "output_type": "execute_result"
121 "self_powers 1000, 10**10"
126 "execution_count": null,
136 "display_name": "Ruby 2.4.0",
141 "file_extension": ".rb",
142 "mimetype": "application/x-ruby",